• I know that plugins can deactivate itself, but how about themes?

    I work on a parent theme (Framework) and I don’t want users to be able to activate it.

    This is what I have so far. The problem is that there is a message coming up from wordpress that the theme is demaged when I do this this way. It shows the last theme there one time but then swiches again to the default theme because wordpress expect the theme I clicked activate for. I need to bypass this somehow. I want to show my own message instead. Any ideas?

    Although I don’t know if its right to set all to one value, isn’t template supposed to be the parent themes name when there is one? Or does WP figure this out automatically?

    add_action( 'after_switch_theme', 'switch_to_last_theme' );
    
    function switch_to_last_theme( $old_theme ){
    
        echo "<br><br><h1>just for testing last theme: $old_theme</h1>";
    
        update_option('template', $old_theme);
        update_option('stylesheet', $old_theme);
        update_option('current_theme', $old_theme);
    
    }

    I asked this exact same Question on stackexchange as well btw. But the answer there only partially helped.

    [ Please do not bump, it’s not permitted here. ]

  • The topic ‘Is there a (offical) way for a theme to deactivate itself and show a message in’ is closed to new replies.