LLMS_REST_Posts_Controller::map_params_to_query_args( array $prepared, array $registered, WP_REST_Request $request )

Map schema to query arguments to retrieve a collection of objects.


Parameters Parameters

$prepared

(array) (Required) Array of collection arguments.

$registered

(array) (Required) Registered collection params.

$request

(WP_REST_Request) (Required) Full details about the request.


Top ↑

Return Return

(array|WP_Error)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-posts-controller.php

		$query_args = $this->prepare_items_query( $prepared, $request );

		return $query_args;

	}

	/**
	 * Map schema to query arguments to retrieve a collection of objects.
	 *
	 * @since 1.0.0-beta.12
	 * @since 1.0.0-beta.19 Map 'status' collection param to to 'post_status' query arg.
	 *
	 * @param array           $prepared   Array of collection arguments.
	 * @param array           $registered Registered collection params.
	 * @param WP_REST_Request $request    Full details about the request.
	 * @return array|WP_Error
	 */
	protected function map_params_to_query_args( $prepared, $registered, $request ) {

		$args = array();

		/*
		* This array defines mappings between public API query parameters whose
		* values are accepted as-passed, and their internal WP_Query parameter
		* name equivalents (some are the same). Only values which are also
		* present in $registered will be set.
		*/
		$parameter_mappings = array(
			'order'   => 'order',
			'orderby' => 'orderby',
			'page'    => 'paged',
			'exclude' => 'post__not_in',
			'include' => 'post__in',
			'search'  => 's',
			'status'  => 'post_status',
		);

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.19 Map 'status' collection param to to 'post_status' query arg.
1.0.0-beta.12 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.