[wp-trac] [WordPress Trac] #21485: Exclude current post from Recent Posts widget
WordPress Trac
noreply at wordpress.org
Tue Aug 20 00:19:17 UTC 2013
#21485: Exclude current post from Recent Posts widget
-------------------------+------------------------------
Reporter: Asif2BD | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 2.8
Severity: normal | Resolution: wontfix
Keywords: has-patch |
-------------------------+------------------------------
Changes (by c3mdigital):
* keywords: ux-feedback has-patch => has-patch
* status: new => closed
* version: => 2.8
* resolution: => wontfix
Comment:
Replying to [comment:1 DrewAPicture]:
> [attachment:21485.diff] Adds a `post__not_in` value to the `WP_Query`.
Not sure if using `get_the_ID()` in this instance is cheating :)
get_the_ID() wouldn't be reliable on an archive, search or page for
posts..
Replying to [comment:3 nacin]:
> If I had to guess, one reason why not to do this would be it would make
caching harder.
Agreed the current post would not be excluded if the cache returned then
if the cache was built without the current post then on other pages it
would be missing. The only alternative I can think of is to add an
additional post to the query args and check in the loop for the existing
id then continue if found. Even that seams kind of hackish but would
work.
I'm closing as wontfix as we can let theme developers do this on their own
using the widget_posts_args filter.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21485#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list