[wp-trac] [WordPress Trac] #33921: Twenty Fourteen: Featured_Content::get_sticky_posts() getting also non published posts

WordPress Trac noreply at wordpress.org
Fri Sep 18 15:11:48 UTC 2015


#33921: Twenty Fourteen: Featured_Content::get_sticky_posts() getting also non
published posts
-------------------------------+------------------------------
 Reporter:  stode              |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Bundled Theme      |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by stode):

 Thanks Sergey,

 Your observation is right.

 I did not describe to problem properly. The test case for me was that I
 had a limit set to fetch five IDs by Featured_Content::get_sticky_posts()
 and all of the IDs were drafts. No featured posts were returned, because
 the method did not get to those IDs.

 Bottom line I was expecting five featured posts, but got none.

 Replying to [comment:1 SergeyBiryukov]:
 > Hi @stode, welcome to Trac!
 >
 > I could not reproduce the issue. My steps:
 >
 > 1. Create a draft sticky post.
 > 2. Make sure I don't have a `featured` tag.
 > 3. Clear the `'featured_content_ids'` transient in the database.
 > 4. The featured content section displays published sticky posts, but not
 the draft post.
 >
 > [source:tags/4.3.1/src/wp-content/themes/twentyfourteen/inc/featured-
 content.php#L189 Featured_Content::get_sticky_posts()] indeed just returns
 the value of `'sticky_posts'` option without any further checking.
 >
 > However, when [source:tags/4.3.1/src/wp-
 content/themes/twentyfourteen/inc/featured-content.php#L114
 Featured_Content::get_featured_posts()] calls `get_posts()` later, the
 implicit default `post_status` value is applied, which is
 [source:tags/4.3.1/src/wp-includes/post.php?marks=1886,1887#L1875
 publish].

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


More information about the wp-trac mailing list