wp_update_https_migration_required()
Updates the 'https_migration_required' option if needed when the given URL has been updated from HTTP to HTTPS.
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 {@see 'update_option_home'} action.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wp_update_https_migration_required( $old_url, $new_url );
- $old_url(разное) (обязательный)
- Previous value of the URL option.
- $new_url(разное) (обязательный)
- New value of the URL option.
Список изменений
С версии 5.7.0 | Введена. |
Код wp_update_https_migration_required() wp update https migration required WP 6.7.1
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 ); }