validate_current_theme example

$this->set_changeset_lock( $this->changeset_post_id() );
        }
    }

    /** * Callback to validate a theme once it is loaded * * @since 3.4.0 */
    public function after_setup_theme() {
        $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
        if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
            wp_redirect( 'themes.php?broken=true' );
            exit;
        }
    }

    /** * If the theme to be previewed isn't the active theme, add filter callbacks * to swap it out at runtime. * * @since 3.4.0 */
    
<span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span> </h1> <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> <a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a> <?php endif; ?> <form class="search-form"></form> <hr class="wp-header-end"> <?php if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
    ?> <div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div> <?php } elseif ( isset( $_GET['activated'] ) ) {
    if ( isset( $_GET['previewed'] ) ) {
        ?> <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> <?php     } else {
        ?> <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
Home | Imprint | This part of the site doesn't use cookies.