• Resolved nicodweb

    (@nicodweb)


    hello , I’m looking for a function to paste on my theme function.php in order to force the plugin défaut options.
    Any idea/help?

    add_filters('the_seo_framework_default_site_options','nw_seo_framework_default_site',10,2);
    function nw_seo_framework_default_site(){
      
      $args= array(
      			// General. Performance.
      			'alter_search_query' => 0, 
      			'alter_archive_query' => 0, 
      
      			......
      
      			// Schema
      			'ld_json_searchbox'   => 1, // LD+Json Sitelinks Searchbox
      			'ld_json_breadcrumbs' => 1, // LD+Json Breadcrumbs
      
      			// Cache.
      			//$this->o_plugin_updated => 1, // Plugin update cache.
      		);
    		return wp_parse_args($args);
    
    }
    • This topic was modified 7 years, 6 months ago by nicodweb.
    • This topic was modified 7 years, 6 months ago by nicodweb.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi Nico,

    You’ll need to overwrite the input argument ($options = []), and then pass it back (return $options;). Here’s an example:

    add_filter( 'the_seo_framework_default_site_options', 'my_default_tsf_site_options' );
    function my_default_tsf_site_options( $options = [] ) {
     
        $options['noydir']            = 1; // Site noydir robots settings
     
        $options['category_noindex'] = 0; // Category Archive robots noindex
        $options['tag_noindex']      = 0; // Tag Archive robots noindex
        $options['author_noindex']   = 0; // Author Archive robots noindex
        $options['date_noindex']     = 0; // Date Archive robots noindex
        $options['search_noindex']   = 0; // Search Page robots noindex
        $options['site_noindex']     = 0; // Site Page robots noindex
     
        return $options;
    }

    I hope this helps 🙂

    • This reply was modified 7 years, 6 months ago by Sybre Waaijer. Reason: Exchanged option that no longer exists
    Thread Starter nicodweb

    (@nicodweb)

    Impressive support !! Thanks cybr!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Function to change default options’ is closed to new replies.