Definition:
function validate_current_theme() {}
Checks that current theme files ‘index.php’ and ‘style.css’ exists.
Does not check the default theme, which is the fallback and should always exist. Will switch theme to the fallback theme if current theme does not validate. You can use the ‘validate_current_theme’ filter to return FALSE to disable this functionality.
Defined filters
- validate_current_theme
apply_filters( 'validate_current_theme', true )
Source code
function validate_current_theme() { // Don't validate during an install/upgrade. if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) ) return true; if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); return false; } if ( get_stylesheet() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/style.css') ) { switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); return false; } if ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) { switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); return false; } return true; }
3319
No comments yet... Be the first to leave a reply!