Opened 3 years ago
Last modified 4 months ago
#11375 new enhancement
allow to disable the private status
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Query | Version: | 2.9 |
| Severity: | normal | Keywords: | dev-feedback featured editorial-flow |
| Cc: | WordPress@…, kovshenin |
Description
The private status generates all sorts of OR clauses in SQL queries, which is bad from a performance standpoint.
Blogs that do not have any private posts or pages should have the ability to disable the feature altogether, in order to optimize the SQL statements.
Adding an option in a Settings page arguably is plugin material, but WP doesn't currently allow to remove the status altogether.
Were it to be implemented, WP should keep a trace (in a transient) of the following:
$has_private_posts = (bool) $wpdb->get_var("SELECT EXISTS 1 FROM $wpdb->posts WHERE post_status = 'private';");
checking its value and disabling the type = private type accordingly in non-admin areas would significantly enhance the user experience for those who never use such things.
Attachments (1)
Change History (12)
I'm using the attached function in a plugin. It makes things *much* faster for logged in users.
Denis-de-Bernardy — 3 years ago
- Keywords dev-feedback added
any interest from the core devs, or should I just close and keep it as a plugin?
I'm not a core dev, think this actually is usefull but since no core-dev has answered to your question it looks like close. So I suggest to close as "wont-enhance" :)
See #11697
comment:6
voyagerfan5761 — 3 years ago
- Cc WordPress@… added
see also #11213
- Keywords bug-hunt added
- Keywords featured added; bug-hunt removed
comment:10
miqrogroove — 3 years ago
- Milestone changed from 3.0 to Future Release
I'm hoping #11914 will get a last-minute commit before beta. It touches some of the private query logic and should help, if anything.
As for this ticket, I don't see any momentum for the 3.0 beta. Let's clear it off the 3.0 plate and find someone to adopt the private post issues in 3.1.
comment:11
kovshenin — 4 months ago
- Cc kovshenin added
- Keywords editorial-flow added
This might be fixed by the work on post statuses in 3.6. See #23168

+1 to this idea.
Question though - how would such removal be dealt with, would it not introduce as many performance issues as it solves? I'm thinking e.g filtering out pre-existing private posts added before such functionality were enabled..