PHP Класс WP_REST_Terms_Controller, wordpress

Наследование: extends WP_REST_Controller
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$meta WP_REST_Term_Meta_Fields Instance of a term meta fields object.
$sort_column string Column to have the terms be sorted by.
$taxonomy string Taxonomy key.
$total_terms integer Number of terms that were found.

Открытые методы

Метод Описание
__construct ( string $taxonomy ) Constructor.
create_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Creates a single term in a taxonomy.
create_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a request has access to create a term.
delete_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Deletes a single term from a taxonomy.
delete_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a request has access to delete the specified term.
get_collection_params ( ) : array Retrieves the query params for collections.
get_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Gets a single term from a taxonomy.
get_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a request has access to read the specified term.
get_item_schema ( ) : array Retrieves the term's schema, conforming to JSON Schema.
get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Retrieves terms associated with a taxonomy.
get_items_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a request has access to read terms in the specified taxonomy.
prepare_item_for_database ( WP_REST_Request $request ) : object Prepares a single term for create or update.
prepare_item_for_response ( obj $item, WP_REST_Request $request ) : WP_REST_Response Prepares a single term output for response.
register_routes ( ) Registers the routes for the objects of the controller.
update_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Updates a single term from a taxonomy.
update_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a request has access to update the specified term.

Защищенные методы

Метод Описание
check_is_taxonomy_allowed ( string $taxonomy ) : boolean Checks that the taxonomy is valid.
prepare_links ( object $term ) : array Prepares links for the request.

Описание методов

__construct() публичный Метод

Constructor.
С версии: 4.7.0
public __construct ( string $taxonomy )
$taxonomy string Taxonomy key.

check_is_taxonomy_allowed() защищенный Метод

Checks that the taxonomy is valid.
С версии: 4.7.0
protected check_is_taxonomy_allowed ( string $taxonomy ) : boolean
$taxonomy string Taxonomy to check.
Результат boolean Whether the taxonomy is allowed for REST management.

create_item() публичный Метод

Creates a single term in a taxonomy.
С версии: 4.7.0
public create_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full details about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

create_item_permissions_check() публичный Метод

Checks if a request has access to create a term.
С версии: 4.7.0
public create_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full details about the request.
Результат boolean | WP_Error True if the request has access to create items, false or WP_Error object otherwise.

delete_item() публичный Метод

Deletes a single term from a taxonomy.
С версии: 4.7.0
public delete_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full details about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

delete_item_permissions_check() публичный Метод

Checks if a request has access to delete the specified term.
С версии: 4.7.0
public delete_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full details about the request.
Результат boolean | WP_Error True if the request has access to delete the item, otherwise false or WP_Error object.

get_collection_params() публичный Метод

Retrieves the query params for collections.
С версии: 4.7.0
public get_collection_params ( ) : array
Результат array Collection parameters.

get_item() публичный Метод

Gets a single term from a taxonomy.
С версии: 4.7.0
public get_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full details about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

get_item_permissions_check() публичный Метод

Checks if a request has access to read the specified term.
С версии: 4.7.0
public get_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full details about the request.
Результат boolean | WP_Error True if the request has read access for the item, otherwise false or WP_Error object.

get_item_schema() публичный Метод

Retrieves the term's schema, conforming to JSON Schema.
С версии: 4.7.0
public get_item_schema ( ) : array
Результат array Item schema data.

get_items() публичный Метод

Retrieves terms associated with a taxonomy.
С версии: 4.7.0
public get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full details about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

get_items_permissions_check() публичный Метод

Checks if a request has access to read terms in the specified taxonomy.
С версии: 4.7.0
public get_items_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full details about the request.
Результат boolean | WP_Error True if the request has read access, otherwise false or WP_Error object.

prepare_item_for_database() публичный Метод

Prepares a single term for create or update.
С версии: 4.7.0
public prepare_item_for_database ( WP_REST_Request $request ) : object
$request WP_REST_Request Request object.
Результат object $prepared_term Term object.

prepare_item_for_response() публичный Метод

Prepares a single term output for response.
С версии: 4.7.0
public prepare_item_for_response ( obj $item, WP_REST_Request $request ) : WP_REST_Response
$item obj Term object.
$request WP_REST_Request Request object.
Результат WP_REST_Response $response Response object.

register_routes() публичный Метод

Registers the routes for the objects of the controller.
См. также: register_rest_route()
С версии: 4.7.0
public register_routes ( )

update_item() публичный Метод

Updates a single term from a taxonomy.
С версии: 4.7.0
public update_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full details about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

update_item_permissions_check() публичный Метод

Checks if a request has access to update the specified term.
С версии: 4.7.0
public update_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full details about the request.
Результат boolean | WP_Error True if the request has access to update the item, false or WP_Error object otherwise.

Описание свойств

$meta защищенное свойство

Instance of a term meta fields object.
С версии: 4.7.0
protected WP_REST_Term_Meta_Fields $meta
Результат WP_REST_Term_Meta_Fields

$sort_column защищенное свойство

Column to have the terms be sorted by.
С версии: 4.7.0
protected string $sort_column
Результат string

$taxonomy защищенное свойство

Taxonomy key.
С версии: 4.7.0
protected string $taxonomy
Результат string

$total_terms защищенное свойство

Number of terms that were found.
С версии: 4.7.0
protected int $total_terms
Результат integer