WPSEO_Admin_Init::show_hook_deprecation_warnings
Shows deprecation warnings to the user if a plugin has registered a filter we have deprecated.
Метод класса: WPSEO_Admin_Init{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WPSEO_Admin_Init = new WPSEO_Admin_Init(); $WPSEO_Admin_Init->show_hook_deprecation_warnings();
Код WPSEO_Admin_Init::show_hook_deprecation_warnings() WPSEO Admin Init::show hook deprecation warnings Yoast 26.5
public function show_hook_deprecation_warnings() {
global $wp_filter;
if ( wp_doing_ajax() ) {
return;
}
// WordPress hooks that have been deprecated since a Yoast SEO version.
$deprecated_filters = [
'wpseo_genesis_force_adjacent_rel_home' => [
'version' => '9.4',
'alternative' => null,
],
'wpseo_opengraph' => [
'version' => '14.0',
'alternative' => null,
],
'wpseo_twitter' => [
'version' => '14.0',
'alternative' => null,
],
'wpseo_twitter_taxonomy_image' => [
'version' => '14.0',
'alternative' => null,
],
'wpseo_twitter_metatag_key' => [
'version' => '14.0',
'alternative' => null,
],
'wp_seo_get_bc_ancestors' => [
'version' => '14.0',
'alternative' => 'wpseo_breadcrumb_links',
],
'validate_facebook_app_id_api_response_code' => [
'version' => '15.5',
'alternative' => null,
],
'validate_facebook_app_id_api_response_body' => [
'version' => '15.5',
'alternative' => null,
],
];
// Determine which filters have been registered.
$deprecated_notices = array_intersect(
array_keys( $deprecated_filters ),
array_keys( $wp_filter )
);
// Show notice for each deprecated filter or action that has been registered.
foreach ( $deprecated_notices as $deprecated_filter ) {
$deprecation_info = $deprecated_filters[ $deprecated_filter ];
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- Only uses the hardcoded values from above.
_deprecated_hook(
$deprecated_filter,
'WPSEO ' . $deprecation_info['version'],
$deprecation_info['alternative']
);
// phpcs:enable
}
}