From f17d43e620fedd781478ea20bc91e9696f22473a Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 26 Feb 2014 20:31:00 +0000 Subject: [PATCH] Add a filter to remove or rename page templates for a theme. This does not yet handle adding page templates. see #13265. git-svn-id: https://develop.svn.wordpress.org/trunk@27297 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-theme.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index c18896ec17..9cfe23d9e5 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -963,7 +963,19 @@ final class WP_Theme implements ArrayAccess { if ( $this->parent() ) $page_templates += $this->parent()->get_page_templates(); - return $page_templates; + /** + * Remove or rename page templates for a theme. + * + * This filter does not currently allow for page templates to be added. + * + * @since 3.9.0 + * + * @param array $page_templates Array of page templates. Keys are filenames, + * values are translated names. + * @param WP_Theme $this The theme object. + */ + $return = apply_filters( 'page_templates', $page_templates, $this ); + return array_intersect_assoc( $return, $page_templates ); } /**