| @@ -50,13 +50,8 @@ | ||
| 50 | 50 | add_action( 'pre_get_posts', [ $this, 'pre_get_posts' ], 1 ); |
| 51 | 51 | add_action( 'wp', function () { |
| 52 | 52 | new TemplateLoader( $this, self::$views ); |
| 53 | 53 | } ); |
| 54 | - // Unconditional (admin + front end): the editor's admin page bootstrap | |
| 55 | - // (post.php?action=elementor) never fires `wp`, so this can't be gated | |
| 56 | - // behind the TemplateLoader instantiation above. See TemplateLoader:: | |
| 57 | - // register_preview_product_hooks() for why two render pathways are covered. | |
| 58 | - TemplateLoader::register_preview_product_hooks(); | |
| 59 | 54 | |
| 60 | 55 | add_action( 'init', [ $this, 'source_register' ] ); |
| 61 | 56 | add_action( 'wp_ajax_templately_create_template', [ $this, 'create_template' ] ); |
| 62 | 57 | |
| @@ -103,14 +98,8 @@ | ||
| 103 | 98 | |
| 104 | 99 | public function create_template() { |
| 105 | 100 | check_admin_referer( 'templately_create_template' ); |
| 106 | 101 | |
| 107 | - // Check user capability | |
| 108 | - if (!current_user_can('delete_posts')) { | |
| 109 | - wp_send_json_error(['message' => 'Insufficient permissions']); | |
| 110 | - wp_die(); | |
| 111 | - } | |
| 112 | - | |
| 113 | 102 | $_type = sanitize_text_field( wp_unslash( $_POST['template_type'] ) ); |
| 114 | 103 | |
| 115 | 104 | $_meta = []; |
| 116 | 105 | |
| @@ -204,10 +193,9 @@ | ||
| 204 | 193 | return $post_id; |
| 205 | 194 | } |
| 206 | 195 | |
| 207 | 196 | public function modify_template_type( $value, $object_id, $meta_key, $single ) { |
| 208 | - $_value = $value; | |
| 209 | - if ( empty($value) && Document::TYPE_META_KEY === $meta_key && Source::CPT === get_post_type( $object_id ) ) { | |
| 197 | + if ( Document::TYPE_META_KEY === $meta_key && Source::CPT === get_post_type( $object_id ) ) { | |
| 210 | 198 | remove_filter( 'get_post_metadata', [ $this, 'modify_template_type' ] ); |
| 211 | 199 | $value = get_post_meta( $object_id, Source::TYPE_META_KEY, $single ); |
| 212 | 200 | $arr = [ |
| 213 | 201 | 'post' => 'single-post', |
| @@ -219,11 +207,8 @@ | ||
| 219 | 207 | 'course_archive' => 'archive', |
| 220 | 208 | ]; |
| 221 | 209 | $key = $single ? $value : (isset($value[0]) ? $value[0] : ''); |
| 222 | 210 | $value = isset( $arr[ $key ] ) ? $arr[ $key ] : $value; |
| 223 | - if(in_array($value, ['header', 'footer'])){ | |
| 224 | - return $_value; | |
| 225 | - } | |
| 226 | 211 | } |
| 227 | 212 | |
| 228 | 213 | return $value; |
| 229 | 214 | } |