WordPress.org

Make WordPress Core

Changeset 21847


Ignore:
Timestamp:
09/14/12 18:36:08 (19 months ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r21846 r21847  
    27642764    if ( !empty($page_template) && 'page' == $data['post_type'] ) { 
    27652765        $post->page_template = $page_template; 
    2766         $page_templates = get_page_templates(); 
    2767         if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) { 
     2766        $page_templates = wp_get_theme()->get_page_templates(); 
     2767        if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) { 
    27682768            if ( $wp_error ) 
    27692769                return new WP_Error('invalid_page_template', __('The page template is invalid.')); 
Note: See TracChangeset for help on using the changeset viewer.