Posts, Post Types: Improve sanitisation of templates' post types.

Prevents post type templates ignoring post types due to invalid characters. Each entry in the `Template Post Type` comment is run through `sanitize_key()` to match the sanitisation used by `register_post_type()`.

Fixes #38766.

Built from https://develop.svn.wordpress.org/trunk@39236


git-svn-id: http://core.svn.wordpress.org/trunk@39176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2016-11-15 03:37:31 +00:00
parent fc1255a2c7
commit 21248ce3ab
2 changed files with 2 additions and 2 deletions

View File

@ -1038,7 +1038,7 @@ final class WP_Theme implements ArrayAccess {
}
foreach ( $types as $type ) {
$type = trim( $type );
$type = sanitize_key( $type );
if ( ! isset( $post_templates[ $type ] ) ) {
$post_templates[ $type ] = array();
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-beta3-39235';
$wp_version = '4.7-beta3-39236';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.