[wp-trac] [WordPress Trac] #54708: Improve `_set_preview` for case when autosave missing

WordPress Trac noreply at wordpress.org
Wed Dec 29 18:37:36 UTC 2021


#54708: Improve `_set_preview` for case when autosave missing
------------------------------------------------+--------------------------
 Reporter:  adamsilverstein                     |       Owner:
                                                |  adamsilverstein
     Type:  defect (bug)                        |      Status:  assigned
 Priority:  normal                              |   Milestone:  Awaiting
                                                |  Review
Component:  General                             |     Version:
 Severity:  normal                              |  Resolution:
 Keywords:  dev-feedback has-patch 2nd-opinion  |     Focuses:
------------------------------------------------+--------------------------

Comment (by adamsilverstein):

 After some digging here the underlying bug is actually in `_set_preview` -
 when an autosave is missing for a post, the current function bails early,
 and never applies the tem or thumbnail filters:

  add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
  add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10,
 3 );

 The reason an autosave may not exist is: when the autosave content, title
 and excerpt and content exactly match it's parent post, we delete it. In
 this case, we can skip the reassignment of these values, but still apply
 the correct filters to the preview.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54708#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list