| @@ -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' ) && !current_user_can( 'edit_posts' ) ) { | |
| 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, |
| @@ -46,16 +46,16 @@ | ||
| 46 | 46 | // Register Custom Post Type |
| 47 | 47 | function blockspare_custom_post_type() { |
| 48 | 48 | |
| 49 | 49 | $labels = array( |
| 50 | - 'name' => _x( 'My Templates', 'Post Type General Name', 'blockspare' ), | |
| 51 | - 'singular_name' => _x( 'My Templates', 'Post Type Singular Name', 'blockspare' ), | |
| 52 | - 'menu_name' => __( 'My Templates', 'blockspare' ), | |
| 50 | + 'name' => _x( 'My Patterns', 'Post Type General Name', 'blockspare' ), | |
| 51 | + 'singular_name' => _x( 'My Patterns', 'Post Type Singular Name', 'blockspare' ), | |
| 52 | + 'menu_name' => __( 'My Patterns', 'blockspare' ), | |
| 53 | 53 | 'parent_item_colon' => __( 'My Parent Item:', 'blockspare' ), |
| 54 | 54 | |
| 55 | 55 | ); |
| 56 | 56 | $args = array( |
| 57 | - 'label' => __( 'My Templates', 'blockspare' ), | |
| 57 | + 'label' => __( 'My Patterns', 'blockspare' ), | |
| 58 | 58 | 'description' => __( 'Tempaltes created by users', 'blockspare' ), |
| 59 | 59 | 'labels' => $labels, |
| 60 | 60 | 'supports' => array( 'title', 'editor', 'thumbnail','blockeditor' ), |
| 61 | 61 | 'hierarchical' => false, |