[wp-trac] [WordPress Trac] #39254: When in Customizer Preview, starter content posts are not displayed in the loop

WordPress Trac noreply at wordpress.org
Tue Dec 13 05:06:16 UTC 2016


#39254: When in Customizer Preview, starter content posts are not displayed in the
loop
--------------------------+---------------------------------------
 Reporter:  tiagonoronha  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.7.1
Component:  Customize     |     Version:  4.7
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  administration, template
--------------------------+---------------------------------------
Changes (by westonruter):

 * milestone:  4.8 => 4.7.1


Comment:

 Thinking about this a bit more, there may be a solution that could fix the
 issue specifically for page/post stubs added via starter content. A
 simpler solution than the one for Customize Posts could be implemented
 because the customizer as of 4.7 doesn't allow you to preview any changes
 to the stubbed posts or their postmeta, and so we don't need to worry
 about injecting the customized state into the queries. In short, what we'd
 need to do filter `posts_where` to amend the conditions for the
 `post_status` checks to also include:

 {{{
 "OR {$wpdb->posts}.ID IN ( " . join( ',',
 $wp_customize->get_setting('nav_menus_created_posts')->value() ) . " )"
 }}}

 so that these posts will match queries for `publish` posts even though
 they have the `auto-draft` status. With this done, the posts should then
 be included in the results. And then the `publish` status should be set on
 each of the queried `posts` via the `posts_results` filter and also
 supplied via the `get_post_status` filter so that these `auto-draft` posts
 won't get filtered out of the resulting posts array.

 The code required to do this would be small and I think could be in scope
 for a point release, such as 4.7.1.

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


More information about the wp-trac mailing list