Automatic update of Child Theme to Parent Theme

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() );
}


Leave a Reply

Your email address will not be published. Required fields are marked *