| @@ -1,0 +1,42 @@ | ||
| 1 | +<?php | |
| 2 | +/* | |
| 3 | + * License: GPLv3 | |
| 4 | + * License URI: https://www.gnu.org/licenses/gpl.txt | |
| 5 | + * Copyright 2024-2026 Jean-Sebastien Morisset (https://wpsso.com/) | |
| 6 | + */ | |
| 7 | + | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + | |
| 10 | + die( 'These aren\'t the droids you\'re looking for.' ); | |
| 11 | +} | |
| 12 | + | |
| 13 | +if ( ! class_exists( 'WpssoIntegUtilDuplicatePost' ) ) { | |
| 14 | + | |
| 15 | + class WpssoIntegUtilDuplicatePost { | |
| 16 | + | |
| 17 | + private $p; // Wpsso class object. | |
| 18 | + | |
| 19 | + public function __construct( &$plugin ) { | |
| 20 | + | |
| 21 | + $this->p =& $plugin; | |
| 22 | + | |
| 23 | + if ( $this->p->debug->enabled ) { | |
| 24 | + | |
| 25 | + $this->p->debug->mark(); | |
| 26 | + } | |
| 27 | + | |
| 28 | + /* | |
| 29 | + * Prevent Yoast Duplicate Post from creating duplicate entries in the metadata table. | |
| 30 | + */ | |
| 31 | + add_filter( 'duplicate_post_excludelist_filter', array( $this, 'duplicate_post_excludelist_filter' ), 10, 1 ); | |
| 32 | + } | |
| 33 | + | |
| 34 | + /* | |
| 35 | + * Prevent Yoast Duplicate Post from creating duplicate entries in the metadata table. | |
| 36 | + */ | |
| 37 | + public function duplicate_post_excludelist_filter( $exclude_keys ) { | |
| 38 | + | |
| 39 | + return WpssoAbstractWpMeta::add_duplicate_exclude_meta_keys( $exclude_keys ); | |
| 40 | + } | |
| 41 | + } | |
| 42 | +} | |