mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Use wp_get_theme()->get_page_templates() rather than get_page_templates() in wp_insert_post(),
to allow page template setting on the frontend without a fatal error. fixes #21755. git-svn-id: http://core.svn.wordpress.org/trunk@21847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
95c9cd1e6b
commit
a7cd7c3ac7
@ -2763,8 +2763,8 @@ function wp_insert_post($postarr, $wp_error = false) {
|
||||
|
||||
if ( !empty($page_template) && 'page' == $data['post_type'] ) {
|
||||
$post->page_template = $page_template;
|
||||
$page_templates = get_page_templates();
|
||||
if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) {
|
||||
$page_templates = wp_get_theme()->get_page_templates();
|
||||
if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) {
|
||||
if ( $wp_error )
|
||||
return new WP_Error('invalid_page_template', __('The page template is invalid.'));
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user