PluginProbe
Elementor Website Builder – more than just a page builder / 3.9.0
Elementor Website Builder – more than just a page builder v3.9.0
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/compatibility.php +23 -0 3.8.13.9.0 View file →
@@ -1,7 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 +use Elementor\Core\Base\Document;
4 5 use Elementor\Core\DocumentTypes\PageBase;
5 6 use Elementor\TemplateLibrary\Source_Local;
6 7
7 8 if ( ! defined( 'ABSPATH' ) ) {
@@ -32,8 +33,9 @@
32 33 public static function register_actions() {
33 34 add_action( 'init', [ __CLASS__, 'init' ] );
34 35
35 36 self::polylang_compatibility();
37 + self::yoast_duplicate_post();
36 38
37 39 if ( is_admin() || defined( 'WP_LOAD_IMPORTERS' ) ) {
38 40 add_filter( 'wp_import_post_meta', [ __CLASS__, 'on_wp_import_post_meta' ] );
39 41 add_filter( 'wxr_importer.pre_process.post_meta', [ __CLASS__, 'on_wxr_importer_pre_process_post_meta' ] );
@@ -266,8 +268,29 @@
266 268 Plugin::$instance->db->copy_elementor_meta( $from, $to );
267 269 }
268 270
269 271 return $keys;
272 + }
273 +
274 + private static function yoast_duplicate_post() {
275 + add_filter( 'duplicate_post_excludelist_filter', function( $meta_excludelist ) {
276 + $exclude_list = [
277 + Document::TYPE_META_KEY,
278 + '_elementor_page_assets',
279 + '_elementor_controls_usage',
280 + '_elementor_css',
281 + '_elementor_screenshot',
282 + ];
283 +
284 + return array_merge( $meta_excludelist, $exclude_list );
285 + } );
286 +
287 + add_action( 'duplicate_post_post_copy', function( $new_post_id, $post ) {
288 + $original_template_type = get_post_meta( $post->ID, Document::TYPE_META_KEY, true );
289 + if ( ! empty( $original_template_type ) ) {
290 + update_post_meta( $new_post_id, Document::TYPE_META_KEY, $original_template_type );
291 + }
292 + }, 10, 2 );
270 293 }
271 294
272 295 /**
273 296 * Process post meta before WP importer.