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
@@ -0,0 +1,5 @@
<?php
/*
Template Name: No Trailing Period
Template Post Type: period, full-stop
*/
@@ -0,0 +1,7 @@
<?php
/*
Template Name: Tilde in Post Type.
Template Post Type: period, full~stop
This template should be applied to the `period` post type and ignored by the `full-stop` post type.
*/
@@ -0,0 +1,5 @@
<?php
/*
Template Name: Trailing Comma,
Template Post Type: period, full-stop,
*/
@@ -0,0 +1,5 @@
<?php
/*
Template Name: Trailing Period.
Template Post Type: period, full-stop.
*/
@@ -0,0 +1,5 @@
<?php
/*
Template Name: Trailing Period, White Space.
Template Post Type: period, full-stop.
*/
@@ -0,0 +1,5 @@
<?php
/*
Template Name: Trailing White Space, Period.
Template Post Type: period, full-stop .
*/