| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Manages the compatibility with No Category Base. |
| 8 |
* Works for Yoast SEO too. |
| 9 |
* |
| 10 |
* @since 2.8 |
| 11 |
*/ |
| 12 |
class PLL_No_Category_Base { |
| 13 |
/** |
| 14 |
* Setups actions. |
| 15 |
* |
| 16 |
* @since 2.8 |
| 17 |
*/ |
| 18 |
public function init() { |
| 19 |
add_filter( 'get_terms_args', array( $this, 'no_category_base_get_terms_args' ), 5 ); // Before adding our cache domain. |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Make sure No category base plugins get all the categories when flushing rules. |
| 24 |
* |
| 25 |
* @since 2.1 |
| 26 |
* |
| 27 |
* @param array $args WP_Term_Query arguments. |
| 28 |
* @return array |
| 29 |
*/ |
| 30 |
public function no_category_base_get_terms_args( $args ) { |
| 31 |
if ( doing_filter( 'category_rewrite_rules' ) ) { |
| 32 |
$args['lang'] = ''; |
| 33 |
} |
| 34 |
return $args; |
| 35 |
} |
| 36 |
} |
| 37 |
|