LLMS_REST_Posts_Controller::prepare_items_query( array $prepared_args = array(), WP_REST_Request $request = null )

Determines the allowed query_vars for a get_items() response and prepares them for WP_Query.


Parameters Parameters

$prepared_args

(array) (Optional) Prepared WP_Query arguments.

Default value: array()

$request

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

Default value: null


Top ↑

Return Return

(array) Items query arguments.


Top ↑

Source Source

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

	protected function prepare_items_query( $prepared_args = array(), $request = null ) {

		$query_args = array();

		foreach ( $prepared_args as $key => $value ) {
			$query_args[ $key ] = $value;
		}

		$query_args = $this->prepare_items_query_orderby_mappings( $query_args, $request );

		// Turn exclude and include params into proper arrays.
		foreach ( array( 'post__in', 'post__not_in' ) as $arg ) {
			if ( isset( $query_args[ $arg ] ) && ! is_array( $query_args[ $arg ] ) ) {
				$query_args[ $arg ] = array_map( 'absint', explode( ',', $query_args[ $arg ] ) );
			}
		}

		return $query_args;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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