WPSEO_Plugin_Conflict::hook_check_for_plugin_conflicts()
After activating any plugin, this method will be executed by a hook.
If the activated plugin is conflicting with ours a notice will be shown.
Метод класса: WPSEO_Plugin_Conflict{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WPSEO_Plugin_Conflict::hook_check_for_plugin_conflicts( $plugin );
- $plugin(строка|true|false)
- Optional plugin basename to check.
По умолчанию: false
Код WPSEO_Plugin_Conflict::hook_check_for_plugin_conflicts() WPSEO Plugin Conflict::hook check for plugin conflicts Yoast 23.8
public static function hook_check_for_plugin_conflicts( $plugin = false ) { // The instance of the plugin. $instance = self::get_instance(); // Only add the plugin as an active plugin if $plugin isn't false. if ( $plugin && is_string( $plugin ) ) { $instance->add_active_plugin( $instance->find_plugin_category( $plugin ), $plugin ); } $plugin_sections = []; // Only check for open graph problems when they are enabled. if ( WPSEO_Options::get( 'opengraph' ) ) { /* translators: %1$s expands to Yoast SEO, %2$s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output. */ $plugin_sections['open_graph'] = __( 'Both %1$s and %2$s create Open Graph output, which might make Facebook, X, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo' ) . '<br/><br/>' . '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_page_settings#/site-features#card-wpseo_social-opengraph' ) . '">' /* translators: %1$s expands to Yoast SEO. */ . sprintf( __( 'Configure %1$s\'s Open Graph settings', 'wordpress-seo' ), 'Yoast SEO' ) . '</a>'; } // Only check for XML conflicts if sitemaps are enabled. if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) { /* translators: %1$s expands to Yoast SEO, %2$s: 'Google XML Sitemaps' plugin name of possibly conflicting plugin with regard to the creation of sitemaps. */ $plugin_sections['xml_sitemaps'] = __( 'Both %1$s and %2$s can create XML sitemaps. Having two XML sitemaps is not beneficial for search engines and might slow down your site.', 'wordpress-seo' ) . '<br/><br/>' . '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_page_settings#/site-features#card-wpseo-enable_xml_sitemap' ) . '">' /* translators: %1$s expands to Yoast SEO. */ . sprintf( __( 'Toggle %1$s\'s XML Sitemap', 'wordpress-seo' ), 'Yoast SEO' ) . '</a>'; } /* translators: %2$s expands to 'RS Head Cleaner' plugin name of possibly conflicting plugin with regard to differentiating output between search engines and normal users. */ $plugin_sections['cloaking'] = __( 'The plugin %2$s changes your site\'s output and in doing that differentiates between search engines and normal users, a process that\'s called cloaking. We highly recommend that you disable it.', 'wordpress-seo' ); /* translators: %1$s expands to Yoast SEO, %2$s: 'SEO' plugin name of possibly conflicting plugin with regard to the creation of duplicate SEO meta. */ $plugin_sections['seo'] = __( 'Both %1$s and %2$s manage the SEO of your site. Running two SEO plugins at the same time is detrimental.', 'wordpress-seo' ); $instance->check_plugin_conflicts( $plugin_sections ); }