Ticket #22856: 22856.4.diff
| File 22856.4.diff, 1.5 KB (added by dd32, 5 months ago) |
|---|
-
wp-includes/class-wp-theme.php
206 206 $this->headers['Name'] = $this->stylesheet; 207 207 if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) ) 208 208 $this->errors = new WP_Error( 'theme_not_found', __( 'The theme directory does not exist.' ) ); 209 elseif ( ! glob( $this->theme_root . '/' . $this->stylesheet . '/*' ) ) 210 $this->errors = new WP_Error( 'theme_no_files', __( 'The theme directory does not contain a theme.' ) ); 209 211 else 210 212 $this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) ); 211 213 $this->template = $this->stylesheet; … … 441 443 * Whether the theme exists. 442 444 * 443 445 * A theme with errors exists. A theme with the error of 'theme_not_found', 444 * meaning that the theme's directory was not found, does not exist. 446 * or 'theme_no_files' meaning that the theme's directory was not found, or 447 * doesn't contain any files, does not exist. 445 448 * 446 449 * @since 3.4.0 447 450 * @access public … … 449 452 * @return bool Whether the theme exists. 450 453 */ 451 454 public function exists() { 452 return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes() ) );455 return ! ( $this->errors() && array_intersect( array( 'theme_not_found', 'theme_no_files' ), $this->errors()->get_error_codes() ) ); 453 456 } 454 457 455 458 /**
