From 1b1e18027d87681eb56581bb0ac6db4824912f50 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Fri, 9 Oct 2015 21:51:25 +0000 Subject: [PATCH] Template: Make it possible to both ''add'' and ''remove'' items from the page templates list using the `theme_page_templates` filter. The `theme_page_templates` hook was originally added in [27297] as `page_templates`, and later renamed in [27470]. Previously, it was only possible to remove or rename page templates via this hook. Fixes #13265. Fixes #25879. Built from https://develop.svn.wordpress.org/trunk@34995 git-svn-id: http://core.svn.wordpress.org/trunk@34960 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme.php | 7 ++----- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 7bd9dca3bf..e7e142d6fb 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1021,18 +1021,15 @@ final class WP_Theme implements ArrayAccess { /** * Filter list of page templates for a theme. * - * This filter does not currently allow for page templates to be added. - * * @since 3.9.0 + * @since 4.4.0 Converted to allow complete control over the `$page_templates` array. * * @param array $page_templates Array of page templates. Keys are filenames, * values are translated names. * @param WP_Theme $this The theme object. * @param WP_Post|null $post The post being edited, provided for context, or null. */ - $return = apply_filters( 'theme_page_templates', $page_templates, $this, $post ); - - return array_intersect_assoc( $return, $page_templates ); + return (array) apply_filters( 'theme_page_templates', $page_templates, $this, $post ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 3489867b00..22040a64f0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34994'; +$wp_version = '4.4-alpha-34995'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.