| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | 'methods'=>\WP_REST_Server::EDITABLE, |
| 6 | 6 | 'callback' => 'blockspare_save_templates_callback', |
| 7 | 7 | 'permission_callback' => function ($request) { |
| 8 | 8 | $nonce = $request->get_header( 'X-WP-Nonce' ); |
| 9 | - if ( ! wp_verify_nonce( $nonce, 'wp_rest' ) && !current_user_can( 'edit_posts' )) { | |
| 9 | + if ( ! wp_verify_nonce( $nonce, 'wp_rest' ) ) { | |
| 10 | 10 | return new WP_Error( 'rest_forbidden', 'Validation Failed', array( 'status' => 200 ) ); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | return true; |
| @@ -18,9 +18,9 @@ | ||
| 18 | 18 | if(!function_exists('blockspare_custom_post_type')){ |
| 19 | 19 | function blockspare_save_templates_callback(\WP_REST_Request $request) { |
| 20 | 20 | $params = $request->get_params(); |
| 21 | 21 | $post_content = $params['data']; |
| 22 | - $post_title = sanitize_text_field($params['title']); | |
| 22 | + $post_title = $params['title']; | |
| 23 | 23 | $category = $params['category']; |
| 24 | 24 | |
| 25 | 25 | $new_post = array( |
| 26 | 26 | 'post_content' => $post_content, |