Свойство | Type | Description | |
---|---|---|---|
$namespace | string | Endpoint namespace. | |
$post_type | string | Post type. | |
$rest_base | string | Route base. |
Méthode | Description | |
---|---|---|
__construct ( ) | Initialize product actions (parent). | |
add_product_id ( array $args, WP_REST_Request $request ) : array | Adds the parent product ID to the query so we filter / get the correct variations. | |
batch_items ( WP_REST_Request $request ) : array | Bulk create, update and delete items. | |
delete_item ( WP_REST_Request $request ) : WP_Error | boolean | Delete a variation. | |
get_item_schema ( ) : array | Get the Variation's schema, conforming to JSON Schema. | |
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | Prepare a single variation output for response. | |
register_routes ( ) | Register the routes for products. |
Méthode | Description | |
---|---|---|
add_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | Add post meta fields. | |
prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | Prepare a single variation for create or update. | |
prepare_links ( $variation, WP_REST_Request $request ) : array | Prepare links for the request. | |
update_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | Update post meta fields. |
protected add_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | ||
$post | WP_Post | |
$request | WP_REST_Request | |
Résultat | boolean | WP_Error |
public add_product_id ( array $args, WP_REST_Request $request ) : array | ||
$args | array | |
$request | WP_REST_Request | |
Résultat | array |
public batch_items ( WP_REST_Request $request ) : array | ||
$request | WP_REST_Request | Full details about the request. |
Résultat | array | Of WP_Error or WP_REST_Response. |
public delete_item ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request |
Résultat | WP_Error | boolean |
public get_item_schema ( ) : array | ||
Résultat | array |
protected prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | ||
$request | WP_REST_Request | Request object. |
Résultat | WP_Error | stdClass | $data Post object. |
public prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | ||
$post | WP_Post | Post object. |
$request | WP_REST_Request | Request object. |
Résultat | WP_REST_Response | $data |
protected prepare_links ( $variation, WP_REST_Request $request ) : array | ||
$request | WP_REST_Request | Request object. |
Résultat | array | Links for the given product. |
protected update_post_meta_fields ( WP_Post $post, WP_REST_Request $request ) : boolean | WP_Error | ||
$post | WP_Post | |
$request | WP_REST_Request | |
Résultat | boolean | WP_Error |