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.


git-svn-id: https://develop.svn.wordpress.org/trunk@39236 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2016-11-15 03:36:13 +00:00
parent 80bd60fb88
commit f62112fa16
8 changed files with 59 additions and 1 deletions
+1 -1
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();
}