From 1271cbd2588610e4d307a809fdd38bd4b374eaf1 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Oct 2016 21:02:39 +0000 Subject: [PATCH] Themes: Remove `paged.php` from the theme template hierarchy. The position of this template within the hierarchy is of so little use that zero themes in the WordPress.org theme directory make use of it. It's second only to `index.php` in the hierarchy, meaning that any archive template such as `category.php` or `archive.php` will be chosen before it. Fixes #38162 Props ryankienstra for initial patch git-svn-id: https://develop.svn.wordpress.org/trunk@38755 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/deprecated.php | 14 ++++++++++++++ src/wp-includes/template-loader.php | 1 - src/wp-includes/template.php | 16 ---------------- tests/phpunit/tests/theme.php | 1 - 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index db2a7d7e5c..8315702bab 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -3758,3 +3758,17 @@ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { return ''; } + +/** + * Retrieve path of paged template in current or parent template. + * + * @since 1.5.0 + * @deprecated 4.7.0 The paged.php template is no longer part of the theme template heirarchy. + * + * @return string Full path to paged template file. + */ +function get_paged_template() { + _deprecated_function( __FUNCTION__, '4.7.0' ); + + return get_query_template( 'paged' ); +} diff --git a/src/wp-includes/template-loader.php b/src/wp-includes/template-loader.php index 025f1a8479..1ee7c222c1 100644 --- a/src/wp-includes/template-loader.php +++ b/src/wp-includes/template-loader.php @@ -60,7 +60,6 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : elseif ( is_author() && $template = get_author_template() ) : elseif ( is_date() && $template = get_date_template() ) : elseif ( is_archive() && $template = get_archive_template() ) : - elseif ( is_paged() && $template = get_paged_template() ) : else : $template = get_index_template(); endif; diff --git a/src/wp-includes/template.php b/src/wp-includes/template.php index 946732fac6..2a03a99e71 100644 --- a/src/wp-includes/template.php +++ b/src/wp-includes/template.php @@ -381,22 +381,6 @@ function get_page_template() { return get_query_template( 'page', $templates ); } -/** - * Retrieve path of paged template in current or parent template. - * - * The template hierarchy is filterable via the {@see 'paged_template_hierarchy'} hook. - * The template path is filterable via the {@see 'paged_template'} hook. - * - * @since 1.5.0 - * - * @see get_query_template() - * - * @return string Full path to paged template file. - */ -function get_paged_template() { - return get_query_template('paged'); -} - /** * Retrieve path of search template in current or parent template. * diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index aeb6e3d469..62a88b998f 100644 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -267,7 +267,6 @@ class Tests_Theme extends WP_UnitTestCase { $this->assertEquals(get_date_template(), get_query_template('date')); $this->assertEquals(get_home_template(), get_query_template('home', array('home.php','index.php'))); $this->assertEquals(get_page_template(), get_query_template('page')); - $this->assertEquals(get_paged_template(), get_query_template('paged')); $this->assertEquals(get_search_template(), get_query_template('search')); $this->assertEquals(get_single_template(), get_query_template('single')); $this->assertEquals(get_attachment_template(), get_query_template('attachment'));