multilanguage
1 year ago
recommendations
7 months ago
colibri.php
1 year ago
contact-form.php
1 year ago
entity.php
4 years ago
get-body-class.php
1 year ago
get-classic-page-template.php
1 year ago
get-page-query.php
1 year ago
get-page-title.php
1 year ago
get-post-content.php
1 year ago
get-post-styles.php
1 year ago
index.php
11 months ago
kubio-cloud.php
1 year ago
page-templates.php
4 years ago
save-template-parts-filter.php
1 year ago
subscribe-form.php
4 years ago
typekit.php
4 years ago
update-settings-flags.php
1 year ago
entity.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | function kubio_save_entity_rest_endpoint( WP_REST_Request $request ) { |
| 5 | $post_data = (object) $request['postData']; |
| 6 | $new_status = $request['status']; |
| 7 | $type = $request['type']; |
| 8 | return apply_filters( "kubio/save-template-entity/{$post_data->type}/{$new_status}", $post_data, $type ); |
| 9 | } |
| 10 | |
| 11 | add_action( |
| 12 | 'rest_api_init', |
| 13 | function () { |
| 14 | $namespace = 'kubio/v1'; |
| 15 | |
| 16 | register_rest_route( |
| 17 | $namespace, |
| 18 | '/save-entity', |
| 19 | array( |
| 20 | 'methods' => WP_REST_Server::EDITABLE, |
| 21 | 'callback' => 'kubio_save_entity_rest_endpoint', |
| 22 | 'permission_callback' => function () { |
| 23 | return current_user_can( 'edit_theme_options' ); |
| 24 | }, |
| 25 | |
| 26 | ) |
| 27 | ); |
| 28 | } |
| 29 | ); |
| 30 |