diff --git a/src/wp-includes/template-loader.php b/src/wp-includes/template-loader.php index 7bf3097d64..95216fe5e0 100644 --- a/src/wp-includes/template-loader.php +++ b/src/wp-includes/template-loader.php @@ -53,6 +53,7 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : remove_filter('the_content', 'prepend_attachment'); elseif ( is_single() && $template = get_single_template() ) : elseif ( is_page() && $template = get_page_template() ) : + elseif ( is_singular() && $template = get_singular_template() ) : elseif ( is_category() && $template = get_category_template() ) : elseif ( is_tag() && $template = get_tag_template() ) : elseif ( is_author() && $template = get_author_template() ) : diff --git a/src/wp-includes/template.php b/src/wp-includes/template.php index d070999132..32aed52b95 100644 --- a/src/wp-includes/template.php +++ b/src/wp-includes/template.php @@ -382,6 +382,21 @@ function get_single_template() { return get_query_template( 'single', $templates ); } +/** + * Retrieve path of singular template in current or parent template. + * + * The template path is filterable via the 'singular_template' hook. + * + * @since 4.3.0 + * + * @see get_query_template() + * + * @return string Full path to singular template file + */ +function get_singular_template() { + return get_query_template( 'singular' ); +} + /** * Retrieve path of attachment template in current or parent template. *