Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

wp_update_https_migration_required() WordPress Function

The wp_update_https_migration_required() function is used to update the migration required flag for a site. This flag is used to indicate whether a site needs to be migrated to HTTPS.

wp_update_https_migration_required( mixed $old_url, mixed $new_url ) #

Updates the ‘https_migration_required’ option if needed when the given URL has been updated from HTTP to HTTPS.


Description

If this is a fresh site, a migration will not be required, so the option will be set as false.

This is hooked into the ‘update_option_home’ action.


Top ↑

Parameters

$old_url

(mixed)(Required)Previous value of the URL option.

$new_url

(mixed)(Required)New value of the URL option.


Top ↑

Source

File: wp-includes/https-migration.php

function wp_update_https_migration_required( $old_url, $new_url ) {
	// Do nothing if WordPress is being installed.
	if ( wp_installing() ) {
		return;
	}

	// Delete/reset the option if the new URL is not the HTTPS version of the old URL.
	if ( untrailingslashit( (string) $old_url ) !== str_replace( 'https://', 'http://', untrailingslashit( (string) $new_url ) ) ) {
		delete_option( 'https_migration_required' );
		return;
	}

	// If this is a fresh site, there is no content to migrate, so do not require migration.
	$https_migration_required = get_option( 'fresh_site' ) ? false : true;

	update_option( 'https_migration_required', $https_migration_required );
}


Top ↑

Changelog

Changelog
VersionDescription
5.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.