Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
100.00% |
1 / 1 |
CRAP | n/a |
0 / 0 |
|
| jetpack_canonical_urls_check_conflicts | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Conflict check for the Canonical URLs module, also loaded while the module is off (see module-extras.php). |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit( 0 ); |
| 10 | } |
| 11 | |
| 12 | require_once dirname( __DIR__ ) . '/seo-tools/seo-tools-conflicts.php'; |
| 13 | |
| 14 | // Disable canonical URL output when a conflicting SEO plugin is active. |
| 15 | add_filter( 'jetpack_disable_canonical_urls', 'jetpack_canonical_urls_check_conflicts' ); |
| 16 | |
| 17 | /** |
| 18 | * Check if a conflicting SEO plugin is active and disable canonical URL output. |
| 19 | * |
| 20 | * @since 15.6 |
| 21 | * @since 16.5 Reads the `jetpack_seo_conflicting_plugin` filter instead of its own plugin list. |
| 22 | * |
| 23 | * @param bool $disabled Whether canonical URL output is already disabled. |
| 24 | * @return bool Whether canonical URL output should be disabled. |
| 25 | */ |
| 26 | function jetpack_canonical_urls_check_conflicts( $disabled ) { |
| 27 | return $disabled || jetpack_seo_has_conflicting_plugin(); |
| 28 | } |