_wpseo_activate() Yoast 1.0
Runs on activation of the plugin.
Хуки из функции
Возвращает
Null. Ничего.
Использование
_wpseo_activate();
Код _wpseo_activate() wpseo activate Yoast 15.6.2
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() ) {
delete_option( 'rewrite_rules' );
}
else {
$wpseo_rewrite = new WPSEO_Rewrite();
$wpseo_rewrite->schedule_flush();
}
// Reset tracking to be disabled by default.
if ( ! WPSEO_Utils::is_yoast_seo_premium() ) {
WPSEO_Options::set( 'tracking', false );
}
WPSEO_Options::set( 'indexing_reason', 'first_install' );
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();
// Schedule cronjob when it doesn't exists on activation.
$wpseo_ryte = new WPSEO_Ryte();
$wpseo_ryte->activate_hooks();
do_action( 'wpseo_activate' );
}