_wpseo_activate()
Runs on activation of the plugin.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуки из функции
Возвращает
null
. Ничего (null).
Использование
_wpseo_activate();
Код _wpseo_activate() wpseo activate Yoast 23.4
function _wpseo_activate() { require_once WPSEO_PATH . 'inc/wpseo-functions.php'; require_once WPSEO_PATH . 'inc/class-wpseo-installation.php'; wpseo_load_textdomain(); // Make sure we have our translations available for the defaults. new WPSEO_Installation(); WPSEO_Options::get_instance(); if ( ! is_multisite() ) { WPSEO_Options::initialize(); } else { WPSEO_Options::maybe_set_multisite_defaults( true ); } WPSEO_Options::ensure_options_exist(); if ( ! is_multisite() || ! ms_is_switched() ) { if ( WPSEO_Options::get( 'stripcategorybase' ) === true ) { // Constructor has side effects so this registers all hooks. $GLOBALS['wpseo_rewrite'] = new WPSEO_Rewrite(); } } add_action( 'shutdown', [ 'WPSEO_Utils', 'clear_rewrites' ] ); WPSEO_Options::set( 'indexing_reason', 'first_install' ); WPSEO_Options::set( 'first_time_install', true ); if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) { WPSEO_Options::set( 'should_redirect_after_install_free', true ); } else { WPSEO_Options::set( 'activation_redirect_timestamp_free', time() ); } // Reset tracking to be disabled by default. if ( ! YoastSEO()->helpers->product->is_premium() && WPSEO_Options::get( 'toggled_tracking' ) !== true ) { WPSEO_Options::set( 'tracking', false ); } do_action( 'wpseo_register_roles' ); WPSEO_Role_Manager_Factory::get()->add(); do_action( 'wpseo_register_capabilities' ); WPSEO_Capability_Manager_Factory::get()->add(); // Clear cache so the changes are obvious. WPSEO_Utils::clear_cache(); do_action( 'wpseo_activate' ); }