[wp-trac] [WordPress Trac] #54708: Fix block theme featured image preview

WordPress Trac noreply at wordpress.org
Mon Jan 3 17:02:38 UTC 2022


#54708: Fix block theme featured image preview
-------------------------------------------------+-------------------------
 Reporter:  adamsilverstein                      |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.9
Component:  General                              |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-screenshots commit     |     Focuses:
  dev-reviewed                                   |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  dev-feedback has-patch has-screenshots commit => has-patch
     has-screenshots commit dev-reviewed


Comment:

 Replying to [comment:6 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.

 Aha, great find Adam! I too was able to reproduce the issue. Can confirm
 [attachment:"54708.3.diff"] resolved it.

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


More information about the wp-trac mailing list