LLMS_REST_Posts_Controller::prepare_collection_items_for_response( array $objects, WP_REST_Request $request )

Prepare collection items for response.

Parameters Parameters


(array) (Required) Array of objects to be prepared for response.


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

Top ↑

Return Return


Top ↑

Source Source

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

	protected function prepare_collection_items_for_response( $objects, $request ) {

		$items = array();

		// Allow access to all password protected posts if the context is edit.
		if ( 'edit' === $request['context'] ) {
			add_filter( 'post_password_required', '__return_false' );

		$items = parent::prepare_collection_items_for_response( $objects, $request );

		// Reset filter.
		if ( 'edit' === $request['context'] ) {
			remove_filter( 'post_password_required', '__return_false' );

		return $items;


Top ↑

Changelog Changelog

Version Description
1.0.0-beta.7 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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