LLMS_REST_Posts_Controller::check_assign_terms_permission( WP_REST_Request $request )

Checks whether current user can assign all terms sent with the current request.


Description Description

Heavily based on WP_REST_Posts_Controller::check_assign_terms_permission().


Top ↑

Parameters Parameters

$request

(WP_REST_Request) (Required) The request object with post and terms data.


Top ↑

Return Return

(bool) Whether the current user can assign the provided terms.


Top ↑

Source Source

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

			}

			// We could use LLMS_Post_Model::set_terms() but it doesn't return a WP_Error which can be useful here.
			$result = wp_set_object_terms( $object_id, $request[ $base ], $taxonomy->name );
			if ( is_wp_error( $result ) ) {
				return $result;
			}
		}
	}

	/**
	 * Checks whether current user can assign all terms sent with the current request.
	 *
	 * Heavily based on WP_REST_Posts_Controller::check_assign_terms_permission().
	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.3 Filter taxonomies by `show_in_llms_rest` property instead of `public`.
	 *
	 * @param WP_REST_Request $request The request object with post and terms data.
	 * @return bool Whether the current user can assign the provided terms.
	 */
	protected function check_assign_terms_permission( $request ) {
		$taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_llms_rest' => true ) );


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.3 Filter taxonomies by show_in_llms_rest property instead of public.
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.