WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I scrub or purge previous theme settings? (3 posts)

  1. keeperbay
    Member
    Posted 1 year ago #

    Is there away to clear all the settings from a theme so when you reactive the theme or reinstall the theme the changes you've made will appear?

    I have a multisite.
    The theme I'm using for all the sub-sites had options where you can enter your own link - I need all the links to go the same place. Pasting the link into each and every sub-site would take forever.

    The theme options comes preset to # in the text field. I need that to have a link in that field in every single sub site.

    I've deleted the theme, reset the theme then delete the theme, reinstalled the theme and no matter what I do that stupid # is in that field.

    However, in every New Subsite created the changes I made to the theme appear in that text field, but in the older installs the # always appears in that field.

    How do I scrub or purge the previous settings in those fields?

  2. David Sader
    Member
    Posted 1 year ago #

    Is there a way, yes.

    But not without some tinkerin' with php.

    Here's what I offer:

    First figure out what option you would like to update.
    Maybe stick something like this in the header.php to see what options are coming out of the db on a given page(find the one giving you the #):

    $foo = wp_load_alloptions();
    	echo '<pre>';
    	print_r($foo);
    	echo '</pre>';

    Second, write a function in a php file in your mu-plugins that hooks the wpmu_upgrade_site(fires when you upgrade network then walks through each blog one by one) action to update_blog_option.

    Here's a generic example

    function my_wordpress_option_reset( $blog_id ) {
    update_blog_option( $blog_id, 'my_wordpress_option','xxxxxxxxxxxxx');
    }
    add_action( 'wpmu_upgrade_site', 'my_wordpress_option_reset' );
  3. keeperbay
    Member
    Posted 1 year ago #

    I think that worked. THANK YOU!!

Topic Closed

This topic has been closed to new replies.

About this Topic