Automatic update of Child Theme to Parent Theme

After automatic update of child theme to parent theme, During update we just update code of theme, but what about WordPress, WordPress still assuming current theme as child theme.

When you activate child theme, there are mainly two site options template and stylesheet who store parent theme and child theme slug. After updating you have to update that site option also (There are others relative options also).

Add following code into your theme function.php

if ( is_child_theme() && 'current-theme-slug' != get_template() ) {
    switch_theme( get_stylesheet() );
}
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s