LLMS_REST_Posts_Controller::handle_status_param( string $status )

Determines validity and normalizes the given status parameter.


Description Description

Heavily based on WP_REST_Posts_Controller::handle_status_param().


Top ↑

Parameters Parameters

$status

(string) (Required) Status.


Top ↑

Return Return

(string|WP_Error) Status or WP_Error if lacking the proper permission.


Top ↑

Source Source

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

		 * The dynamic portion of the hook name, `$this->post_type`, refers to the post type slug.
		 *
		 * @since 1.0.0-beta.9
		 *
		 * @param array           $filters Array of filters to be removed.
		 * @param LLMS_Post_Model $object  LLMS_Post_Model object.
		 */
		return apply_filters( "llms_rest_{$this->post_type}_filters_removed_for_response", array(), $object );

	}

	/**
	 * Determines validity and normalizes the given status parameter.
	 * Heavily based on WP_REST_Posts_Controller::handle_status_param().
	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.18 Use plural post type name.
	 *
	 * @param string $status Status.
	 * @return string|WP_Error Status or WP_Error if lacking the proper permission.
	 */
	protected function handle_status_param( $status ) {

		$post_type_object = get_post_type_object( $this->post_type );
		$post_type_name   = $post_type_object->labels->name;

		switch ( $status ) {
			case 'draft':
			case 'pending':
				break;
			case 'private':


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.18 Use plural post type name.
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.