| @@ -2,9 +2,8 @@ | ||
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Base\Document; |
| 5 | 5 | use Elementor\Core\DynamicTags\Manager; |
| 6 | -use Elementor\TemplateLibrary\Source_Local; | |
| 7 | 6 | |
| 8 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | 8 | exit; // Exit if accessed directly. |
| 10 | 9 | } |
| @@ -277,39 +276,8 @@ | ||
| 277 | 276 | |
| 278 | 277 | return $data_container; |
| 279 | 278 | } |
| 280 | 279 | |
| 281 | - public static function iterate_elementor_documents( $callback, $batch_size = 100, $additional_post_types = [] ) { | |
| 282 | - $processed_posts = 0; | |
| 283 | - | |
| 284 | - while ( true ) { | |
| 285 | - $args = wp_parse_args( [ | |
| 286 | - 'post_type' => array_merge( [ Source_Local::CPT, 'post', 'page' ], $additional_post_types ), | |
| 287 | - 'post_status' => [ 'publish' ], | |
| 288 | - 'posts_per_page' => $batch_size, | |
| 289 | - 'meta_key' => Document::BUILT_WITH_ELEMENTOR_META_KEY, | |
| 290 | - 'meta_value' => 'builder', | |
| 291 | - 'offset' => $processed_posts, | |
| 292 | - 'fields' => 'ids', | |
| 293 | - ] ); | |
| 294 | - | |
| 295 | - $query = new \WP_Query( $args ); | |
| 296 | - | |
| 297 | - if ( empty( $query->posts ) ) { | |
| 298 | - break; | |
| 299 | - } | |
| 300 | - | |
| 301 | - foreach ( $query->posts as $post_id ) { | |
| 302 | - $document = Plugin::$instance->documents->get( $post_id ); | |
| 303 | - $elements_data = $document->get_json_meta( Document::ELEMENTOR_DATA_META_KEY ); | |
| 304 | - | |
| 305 | - $callback( $document, $elements_data ); | |
| 306 | - | |
| 307 | - ++$processed_posts; | |
| 308 | - } | |
| 309 | - } | |
| 310 | - } | |
| 311 | - | |
| 312 | 280 | /** |
| 313 | 281 | * Safely copy Elementor meta. |
| 314 | 282 | * |
| 315 | 283 | * Make sure the original page was built with Elementor and the post is not |
| @@ -349,13 +317,12 @@ | ||
| 349 | 317 | * |
| 350 | 318 | * @since 1.1.0 |
| 351 | 319 | * @access public |
| 352 | 320 | * |
| 353 | - * @param int $from_post_id Original post ID. | |
| 354 | - * @param int $to_post_id Target post ID. | |
| 355 | - * @param ?array $specific_meta_keys Optional. Specific meta keys to copy. Default is null, which copies all elementor meta keys. | |
| 321 | + * @param int $from_post_id Original post ID. | |
| 322 | + * @param int $to_post_id Target post ID. | |
| 356 | 323 | */ |
| 357 | - public function copy_elementor_meta( $from_post_id, $to_post_id, $specific_meta_keys = null ) { | |
| 324 | + public function copy_elementor_meta( $from_post_id, $to_post_id ) { | |
| 358 | 325 | $from_post_meta = get_post_meta( $from_post_id ); |
| 359 | 326 | $core_meta = [ |
| 360 | 327 | '_wp_page_template', |
| 361 | 328 | '_thumbnail_id', |
| @@ -361,12 +328,8 @@ | ||
| 361 | 328 | '_thumbnail_id', |
| 362 | 329 | ]; |
| 363 | 330 | |
| 364 | 331 | foreach ( $from_post_meta as $meta_key => $values ) { |
| 365 | - if ( $specific_meta_keys && ! in_array( $meta_key, $specific_meta_keys, true ) ) { | |
| 366 | - continue; | |
| 367 | - } | |
| 368 | - | |
| 369 | 332 | // Copy only meta with the `_elementor` prefix. |
| 370 | 333 | if ( 0 === strpos( $meta_key, '_elementor' ) || in_array( $meta_key, $core_meta, true ) ) { |
| 371 | 334 | $value = $values[0]; |
| 372 | 335 | |