WPSEO_Installation

This class checks if the wpseo option doesn't exists.

Defined (1)

The class is defined in the following location(s).

/inc/class-wpseo-installation.php  
  1. class WPSEO_Installation { 
  2.  
  3. /** 
  4. * Checks if Yoast SEO is installed for the first time. 
  5. */ 
  6. public function __construct() { 
  7. $is_first_install = $this->is_first_install(); 
  8.  
  9. if ( $is_first_install && WPSEO_Utils::is_api_available() ) { 
  10. add_action( 'wpseo_activate', array( $this, 'set_first_install_options' ) ); 
  11.  
  12. /** 
  13. * When the option doesn't exist, it should be a new install. 
  14. * @return bool 
  15. */ 
  16. private function is_first_install() { 
  17. return ( get_option( 'wpseo' ) === false ); 
  18.  
  19. /** 
  20. * Sets the options on first install for showing the installation notice and disabling of the settings pages. 
  21. */ 
  22. public function set_first_install_options() { 
  23. $options = get_option( 'wpseo' ); 
  24.  
  25. $options['enable_setting_pages'] = false; 
  26. $options['show_onboarding_notice'] = true; 
  27. $options['first_activated_on'] = time(); 
  28.  
  29. update_option( 'wpseo', $options );