Source_Local::CPT, 'post_status' => 'any', 'posts_per_page' => -1, 'meta_query' => [ [ 'key' => Document::TYPE_META_KEY, 'value' => $template_types, ], [ 'key' => static::META_KEY_ELEMENTOR_IMPORT_SESSION_ID, 'value' => $data['session_id'], ], ], ]; $templates_query = new \WP_Query( $query_args ); foreach ( $templates_query->posts as $template_post ) { $template_document = Utils::elementor()->documents->get( $template_post->ID ); $template_document->delete(); } } }