| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Manages the compatibility with Duplicate Post. |
| 8 |
* |
| 9 |
* @since 2.8 |
| 10 |
*/ |
| 11 |
class PLL_Duplicate_Post { |
| 12 |
/** |
| 13 |
* Setups actions. |
| 14 |
* |
| 15 |
* @since 2.8 |
| 16 |
*/ |
| 17 |
public function init() { |
| 18 |
add_filter( 'option_duplicate_post_taxonomies_blacklist', array( $this, 'taxonomies_blacklist' ) ); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Avoid duplicating the 'post_translations' taxonomy. |
| 23 |
* |
| 24 |
* @since 1.8 |
| 25 |
* |
| 26 |
* @param array|string $taxonomies The list of taxonomies not to duplicate. |
| 27 |
* @return array |
| 28 |
*/ |
| 29 |
public function taxonomies_blacklist( $taxonomies ) { |
| 30 |
if ( empty( $taxonomies ) ) { |
| 31 |
$taxonomies = array(); // As we get an empty string when there is no taxonomy. |
| 32 |
} |
| 33 |
|
| 34 |
$taxonomies[] = 'post_translations'; |
| 35 |
return $taxonomies; |
| 36 |
} |
| 37 |
} |
| 38 |
|