Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 31
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Module Name: SEO Tools
4 * Module Description: Optimize titles, meta descriptions, and social previews for better search results.
5 * Sort Order: 35
6 * Recommendation Order: 15
7 * First Introduced: 4.4
8 * Requires Connection: No
9 * Requires User Connection: No
10 * Auto Activate: No
11 * Module Tags: Social, Appearance
12 * Feature: Traffic
13 * Additional Search Queries: search engine optimization, social preview, meta description, custom title format, seo, sitemap, open graph, search engine, title tag
14 *
15 * @package automattic/jetpack
16 */
17
18if ( ! defined( 'ABSPATH' ) ) {
19    exit( 0 );
20}
21
22// Suppress SEO Tools output if any of the following plugins is active. Paid editions come
23// before the free plugins they run alongside, so the first match names the right one.
24$jetpack_seo_conflicting_plugins = array(
25    'wordpress-seo-premium/wp-seo-premium.php'        => 'Yoast SEO Premium',
26    'wordpress-seo/wp-seo.php'                        => 'Yoast SEO',
27    'all-in-one-seo-pack-pro/all_in_one_seo_pack.php' => 'All in One SEO Pro',
28    'all-in-one-seo-pack/all_in_one_seo_pack.php'     => 'All in One SEO',
29    'seo-by-rank-math/rank-math.php'                  => 'Rank Math SEO',
30    'autodescription/autodescription.php'             => 'The SEO Framework',
31    'slim-seo/slim-seo.php'                           => 'Slim SEO',
32    'wp-seopress-pro/seopress-pro.php'                => 'SEOPress PRO',
33    'wp-seopress/seopress.php'                        => 'SEOPress',
34    'seo-key-pro/seo-key.php'                         => 'SEOKEY Pro',
35    'seo-key/seo-key.php'                             => 'SEOKEY',
36);
37
38foreach ( $jetpack_seo_conflicting_plugins as $seo_plugin => $seo_plugin_name ) {
39    if ( Jetpack::is_plugin_active( $seo_plugin ) ) {
40        // Disable all custom meta tags that SEO tools manages.
41        add_filter( 'jetpack_disable_seo_tools', '__return_true' );
42
43        // Also disable default meta tags.
44        add_filter( 'jetpack_seo_meta_tags_enabled', '__return_false' );
45
46        // Let the SEO dashboard name the plugin that now owns the output.
47        add_filter(
48            'jetpack_seo_conflicting_plugin',
49            static function () use ( $seo_plugin_name ) {
50                return $seo_plugin_name;
51            }
52        );
53        break;
54    }
55}
56
57/** This filter is documented in modules/seo-tools/class-jetpack-seo-utils.php */
58if ( ! apply_filters( 'jetpack_disable_seo_tools', false ) ) {
59    require_once __DIR__ . '/seo-tools/class-jetpack-seo.php';
60    new Jetpack_SEO();
61
62    require_once __DIR__ . '/seo-tools/class-jetpack-seo-admin-columns.php';
63    Jetpack_SEO_Admin_Columns::init();
64}