• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / _wpseo_activate() – Runs on activation of the plugin.

You appear to be a bot. Output may be restricted

Description

Runs on activation of the plugin.

Usage

_wpseo_activate();

Parameters

Returns

void

Source

File name: wordpress-seo/wp-seo-main.php


Lines:

1 to 48 of 48
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' );
}
 

 View on GitHub View on Trac

Published: 27th November 2019 | Last updated: 10th December 2020

Primary Sidebar

Information

Function name: _wpseo_activate
Plugin ref: Yoast SEO
Version: 15.4
Sourcefile: wp-seo-main.php
File ref: wp-seo-main.php
API type: private
Deprecated?: No
API Letters: _,A,W

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites