[wp-trac] [WordPress Trac] #29269: save_post doesn't fire when unavailable page template saved to page

WordPress Trac noreply at wordpress.org
Tue Aug 19 19:38:48 UTC 2014


#29269: save_post doesn't fire when unavailable page template saved to page
-----------------------------+-----------------------------
 Reporter:  matthewdietsche  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Themes           |    Version:  3.9.2
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 When you select a page template for a page, and then switch to a theme
 without that page template file, the save_post action will never fire due
 to this logic in wp_insert_post():


 {{{
         if ( !empty($page_template) && 'page' == $data['post_type'] ) {
                 $post->page_template = $page_template;
                 $page_templates = wp_get_theme()->get_page_templates(
 $post );
                 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
                                 return 0;
                 }
                 update_post_meta($post_ID, '_wp_page_template',
 $page_template);
         }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29269>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list