Opened 9 years ago
Closed 9 years ago
#33791 closed enhancement (invalid)
WP Query 'Publish' Only by Default
Reported by: | atomicjack | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
Hi,
Currently, a query will bring back all posts relating to the arguments, regardless of whether they're published, draft, pending, etc, by default.
This is not expected user behaviour.
On default WordPress themes, it displays only published posts by default - so when a user is adding in a query, they expect it to only pull back published posts.
What I suggest is that, rather than including arguments to only include published posts, we instead do the opposite, and have published posts show by default, and have arguments for including other post status'.
This is, admittedly, quite a huge change, and backwards compatibility would be an issue, therefore, this would need to be completed during a major version.
Change History (4)
#2
in reply to:
↑ 1
@
9 years ago
Replying to SergeyBiryukov:
Currently, a query will bring back all posts relating to the arguments, regardless of whether they're published, draft, pending, etc, by default.
It should only happen in admin context, as documented in Codex:
https://codex.wordpress.org/Class_Reference/WP_Query#Status_Parameters
Will need to test more, but in a query I recently wrote, it was pulling draft status' too, where the codex states that for logged-in users, only 'publish' and 'private' should.
Think this area needs reviewing a little.
It should only happen in admin context, as documented in Codex:
https://codex.wordpress.org/Class_Reference/WP_Query#Status_Parameters