[wp-trac] [WordPress Trac] #34422: Remove 'post_status' => 'publish' argument from WP_Query args of the Recent Posts widget
WordPress Trac
noreply at wordpress.org
Sat Oct 24 01:48:20 UTC 2015
#34422: Remove 'post_status' => 'publish' argument from WP_Query args of the Recent
Posts widget
-------------------------+----------------------
Reporter: alexvorn2 | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: General | Version:
Severity: normal | Resolution: invalid
Keywords: | Focuses:
-------------------------+----------------------
Changes (by boonebgorges):
* status: new => closed
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
> I think we need to remove this because the default value of the
post_status argument for WP_Query is already publish.
This is not entirely true. If you don't pass a `post_status` value to
`WP_Query`, a couple different things could happen. If you're logged in,
and looking at an archive, you'll get posts with `post_status=publish` as
well as your own non-public posts. If you're in the admin, you'll
sometimes get more than just 'publish' posts. And you'll always get posts
from public post statuses other than `publish`. The `WP_Query` codex page
spells this out fairly well. Making the change you suggest would result in
a change in behavior in some of these circumstances.
In addition, the fact that we currently pass the `post_status` argument to
the `widget_post_args` filter means that we can't easily remove it -
callbacks will expect `post_status` to be set.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34422#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list