wpseo_set_option

Function used from AJAX calls, takes it variables from $_POST, dies on exit.

Description

wpseo_set_option(); 

Usage

  1. if ( !function_exists( 'wpseo_set_option' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpseo_set_option(); 
  7.  

Defined (1)

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

/admin/ajax.php  
  1. function wpseo_set_option() { 
  2. if ( ! current_user_can( 'manage_options' ) ) { 
  3. die( '-1' ); 
  4.  
  5. check_ajax_referer( 'wpseo-setoption' ); 
  6.  
  7. $option = sanitize_text_field( filter_input( INPUT_POST, 'option' ) ); 
  8. if ( $option !== 'page_comments' ) { 
  9. die( '-1' ); 
  10.  
  11. update_option( $option, 0 ); 
  12. die( '1' );