: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$this->save_option_setting( $wpseo, 'company_logo' );
$this->save_option_setting( $wpseo, 'company_name' );
$this->save_option_setting( $wpseo, 'company_or_person' );
$this->save_option_setting( $wpseo, 'person_name' );
// Remove the website name and altername name as we no longer need them.
$this->cleanup_option_data( 'wpseo' );
// All the breadcrumbs settings have moved to the search appearance settings.
foreach ( array_keys( $wpseo_internallinks ) as $key ) {
$this->save_option_setting( $wpseo_internallinks, $key );
// Convert hidden metabox options to display metabox options.
$title_options = get_option( 'wpseo_titles' );
foreach ( $title_options as $key => $value ) {
if ( strpos( $key, 'hideeditbox-tax-' ) === 0 ) {
$taxonomy = substr( $key, strlen( 'hideeditbox-tax-' ) );
WPSEO_Options::set( 'display-metabox-tax-' . $taxonomy, ! $value );
if ( strpos( $key, 'hideeditbox-' ) === 0 ) {
$post_type = substr( $key, strlen( 'hideeditbox-' ) );
WPSEO_Options::set( 'display-metabox-pt-' . $post_type, ! $value );
// Cleanup removed options.
delete_option( 'wpseo_xml' );
delete_option( 'wpseo_permalinks' );
delete_option( 'wpseo_rss' );
delete_option( 'wpseo_internallinks' );
// Remove possibly present plugin conflict notice for plugin that was removed from the list of conflicting plugins.
$yoast_plugin_conflict = WPSEO_Plugin_Conflict::get_instance();
$yoast_plugin_conflict->clear_error( 'header-footer/plugin.php' );
// Moves the user meta for excluding from the XML sitemap to a noindex.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
$wpdb->query( "UPDATE $wpdb->usermeta SET meta_key = 'wpseo_noindex_author' WHERE meta_key = 'wpseo_excludeauthorsitemap'" );
* Perform the 7.1 upgrade.
private function upgrade_71() {
$this->cleanup_option_data( 'wpseo_social' );
// Move the breadcrumbs setting and invert it.
$title_options = $this->get_option_from_database( 'wpseo_titles' );
if ( array_key_exists( 'breadcrumbs-blog-remove', $title_options ) ) {
WPSEO_Options::set( 'breadcrumbs-display-blog-page', ! $title_options['breadcrumbs-blog-remove'] );
$this->cleanup_option_data( 'wpseo_titles' );
* Perform the 7.3 upgrade.
private function upgrade_73() {
// We've moved the cornerstone checkbox to our proper namespace.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
$wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_yoast_wpseo_is_cornerstone' WHERE meta_key = '_yst_is_cornerstone'" );
// Remove the previous Whip dismissed message, as this is a new one regarding PHP 5.2.
delete_option( 'whip_dismiss_timestamp' );
* Performs the 7.4 upgrade.
protected function upgrade_74() {
$this->remove_sitemap_validators();
* Performs the 7.5.3 upgrade.
* When upgrading purging media is potentially relevant.
private function upgrade_753() {
// Only when attachments are not disabled.
if ( WPSEO_Options::get( 'disable-attachment' ) === true ) {
// Only when attachments are not no-indexed.
if ( WPSEO_Options::get( 'noindex-attachment' ) === true ) {
// Set purging relevancy.
WPSEO_Options::set( 'is-media-purge-relevant', true );
* Performs the 7.7 upgrade.
private function upgrade_77() {
// Remove all OpenGraph content image cache.
$this->delete_post_meta( '_yoast_wpseo_post_image_cache' );
* Performs the 7.7.2 upgrade.
private function upgrade_772() {
if ( YoastSEO()->helpers->woocommerce->is_active() ) {
$this->migrate_woocommerce_archive_setting_to_shop_page();
* Performs the 9.0 upgrade.
protected function upgrade_90() {
// Invalidate all sitemap cache transients.
WPSEO_Sitemaps_Cache_Validator::cleanup_database();
// Removes all scheduled tasks for hitting the sitemap index.
wp_clear_scheduled_hook( 'wpseo_hit_sitemap_index' );
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
[ $wpdb->options, 'option_name', 'wpseo_sitemap_%' ]
* Performs the 10.0 upgrade.
private function upgrade_100() {
// Removes recalibration notifications.
$this->clean_all_notifications();
// Removes recalibration options.
WPSEO_Options::clean_up( 'wpseo' );
delete_option( 'wpseo_recalibration_beta_mailinglist_subscription' );
* Performs the 11.1 upgrade.
private function upgrade_111() {
// Set company_or_person to company when it's an invalid value.
$company_or_person = WPSEO_Options::get( 'company_or_person', '' );
if ( ! in_array( $company_or_person, [ 'company', 'person' ], true ) ) {
WPSEO_Options::set( 'company_or_person', 'company' );
* Performs the 12.3 upgrade.
* Removes the about notice when its still in the database.
private function upgrade_123() {
'video-seo-for-wordpress-seo-by-yoast',
'local-seo-for-yoast-seo',
$center = Yoast_Notification_Center::get();
foreach ( $plugins as $plugin ) {
$center->remove_notification_by_id( 'wpseo-outdated-yoast-seo-plugin-' . $plugin );
* Performs the 12.4 upgrade.
* Removes the Google plus defaults from the database.
private function upgrade_124() {
$this->cleanup_option_data( 'wpseo_social' );
* Performs the 12.5 upgrade.
public function upgrade_125() {
// Disables the force rewrite title when the theme supports it through WordPress.
if ( WPSEO_Options::get( 'forcerewritetitle', false ) && current_theme_supports( 'title-tag' ) ) {
WPSEO_Options::set( 'forcerewritetitle', false );
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
[ $wpdb->usermeta, 'meta_key', 'wp_yoast_promo_hide_premium_upsell_admin_block' ]
// Removes the WordPress update notification, because it is no longer necessary when WordPress 5.3 is released.
$center = Yoast_Notification_Center::get();
$center->remove_notification_by_id( 'wpseo-dismiss-wordpress-upgrade' );
* Performs the 12.8 upgrade.
private function upgrade_128() {
// Re-save wpseo to make sure bf_banner_2019_dismissed key is gone.
$this->cleanup_option_data( 'wpseo' );
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-dismiss-page_comments-notice' );
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-dismiss-wordpress-upgrade' );
* Performs the 13.2 upgrade.
private function upgrade_132() {
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-dismiss-tagline-notice' );
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-dismiss-permalink-notice' );
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-dismiss-onpageorg' );
// Transfers the onpage option value to the ryte option.
$ryte_option = get_option( 'wpseo_ryte' );
$onpage_option = get_option( 'wpseo_onpage' );
if ( ! $ryte_option && $onpage_option ) {
update_option( 'wpseo_ryte', $onpage_option );
delete_option( 'wpseo_onpage' );
// Changes onpage_indexability to ryte_indexability.
$wpseo_option = get_option( 'wpseo' );
if ( isset( $wpseo_option['onpage_indexability'] ) && ! isset( $wpseo_option['ryte_indexability'] ) ) {
$wpseo_option['ryte_indexability'] = $wpseo_option['onpage_indexability'];
unset( $wpseo_option['onpage_indexability'] );
update_option( 'wpseo', $wpseo_option );
if ( wp_next_scheduled( 'wpseo_ryte_fetch' ) ) {
wp_clear_scheduled_hook( 'wpseo_ryte_fetch' );
* Re-register capabilities to add the new `view_site_health_checks`
* capability to the SEO Manager role.
do_action( 'wpseo_register_capabilities' );
WPSEO_Capability_Manager_Factory::get()->add();
* Perform the 14.0.3 upgrade.
private function upgrade_1403() {
WPSEO_Options::set( 'ignore_indexation_warning', false );
* Performs the 14.1 upgrade.
private function upgrade_141() {
* These notifications are retrieved from storage on the `init` hook with
* priority 1. We need to remove them after they're retrieved.
add_action( 'init', [ $this, 'remove_notifications_for_141' ] );
add_action( 'init', [ $this, 'clean_up_private_taxonomies_for_141' ] );
$this->reset_permalinks_of_attachments_for_141();
* Performs the 14.2 upgrade.
* Removes the yoast-acf-analysis notice when it's still in the database.
private function upgrade_142() {
add_action( 'init', [ $this, 'remove_acf_notification_for_142' ] );
* Performs the 14.5 upgrade.
private function upgrade_145() {
add_action( 'init', [ $this, 'set_indexation_completed_option_for_145' ] );
* Performs the 14.9 upgrade.
private function upgrade_149() {
$version = get_option( 'wpseo_license_server_version', 2 );
WPSEO_Options::set( 'license_server_version', $version );
delete_option( 'wpseo_license_server_version' );
* Performs the 15.1 upgrade.
private function upgrade_151() {
$this->set_home_url_for_151();
$this->move_indexables_indexation_reason_for_151();
add_action( 'init', [ $this, 'set_permalink_structure_option_for_151' ] );
add_action( 'init', [ $this, 'store_custom_taxonomy_slugs_for_151' ] );
* Performs the 15.3 upgrade.
private function upgrade_153() {
WPSEO_Options::set( 'category_base_url', get_option( 'category_base' ) );
WPSEO_Options::set( 'tag_base_url', get_option( 'tag_base' ) );
// Rename a couple of options.
$indexation_started_value = WPSEO_Options::get( 'indexation_started' );
WPSEO_Options::set( 'indexing_started', $indexation_started_value );
$indexables_indexing_completed_value = WPSEO_Options::get( 'indexables_indexation_completed' );
WPSEO_Options::set( 'indexables_indexing_completed', $indexables_indexing_completed_value );
* Performs the 15.5 upgrade.
private function upgrade_155() {
// Unset the fbadminapp value in the wpseo_social option.
$wpseo_social_option = get_option( 'wpseo_social' );
if ( isset( $wpseo_social_option['fbadminapp'] ) ) {
unset( $wpseo_social_option['fbadminapp'] );
update_option( 'wpseo_social', $wpseo_social_option );
* Performs the 15.7 upgrade.
private function upgrade_157() {
add_action( 'init', [ $this, 'remove_plugin_updated_notification_for_157' ] );
* Performs the 15.9.1 upgrade routine.
private function upgrade_1591() {
$enabled_auto_updates = get_option( 'auto_update_plugins' );
$addon_update_watcher = YoastSEO()->classes->get( Addon_Update_Watcher::class );
$addon_update_watcher->toggle_auto_updates_for_add_ons( 'auto_update_plugins', [], $enabled_auto_updates );
* Performs the 16.2 upgrade routine.
private function upgrade_162() {
$enabled_auto_updates = get_site_option( 'auto_update_plugins' );
$addon_update_watcher = YoastSEO()->classes->get( Addon_Update_Watcher::class );
$addon_update_watcher->toggle_auto_updates_for_add_ons( 'auto_update_plugins', $enabled_auto_updates, [] );
* Performs the 16.5 upgrade.
private function upgrade_165() {
add_action( 'init', [ $this, 'copy_og_settings_from_social_to_titles' ], 99 );
// Run after the WPSEO_Options::enrich_defaults method which has priority 99.
add_action( 'init', [ $this, 'reset_og_settings_to_default_values' ], 100 );
* Performs the 17.2 upgrade. Cleans out any unnecessary indexables. See $cleanup_integration->get_cleanup_tasks() to see what will be cleaned out.
private function upgrade_172() {
wp_unschedule_hook( 'wpseo_cleanup_orphaned_indexables' );
wp_unschedule_hook( 'wpseo_cleanup_indexables' );
if ( ! wp_next_scheduled( Cleanup_Integration::START_HOOK ) ) {
wp_schedule_single_event( ( time() + ( MINUTE_IN_SECONDS * 5 ) ), Cleanup_Integration::START_HOOK );
* Performs the 17.7.1 upgrade routine.
private function upgrade_1771() {
$enabled_auto_updates = get_site_option( 'auto_update_plugins' );
$addon_update_watcher = YoastSEO()->classes->get( Addon_Update_Watcher::class );
$addon_update_watcher->toggle_auto_updates_for_add_ons( 'auto_update_plugins', $enabled_auto_updates, [] );
* Performs the 17.9 upgrade routine.
private function upgrade_179() {
WPSEO_Options::set( 'wincher_integration_active', true );
* Performs the 18.3 upgrade routine.
private function upgrade_183() {
$this->delete_post_meta( 'yoast-structured-data-blocks-images-cache' );
* Performs the 18.6 upgrade routine.
private function upgrade_186() {
WPSEO_Options::set( 'allow_wincher_integration_active', false );
* Performs the 18.9 upgrade routine.