Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#11375 closed enhancement (maybelater)

allow to disable the private status

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by: ryan's profile ryan
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: Query Keywords: needs-patch performance
Focuses: Cc:


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)

has-private-posts.php (1.0 KB) - added by Denis-de-Bernardy 14 years ago.

Download all attachments as: .zip

Change History (14)

#1 @mrmist
14 years ago

+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..

#2 @Denis-de-Bernardy
14 years ago

I'm using the attached function in a plugin. It makes things *much* faster for logged in users.

#3 @Denis-de-Bernardy
14 years ago

  • Keywords dev-feedback added

any interest from the core devs, or should I just close and keep it as a plugin?

#4 @hakre
14 years ago

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" :)

#6 @voyagerfan5761
14 years ago

  • Cc WordPress@… added

#8 @Denis-de-Bernardy
14 years ago

  • Keywords bug-hunt added

#9 @Denis-de-Bernardy
14 years ago

  • Keywords featured added; bug-hunt removed

#10 @miqrogroove
14 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.

#11 @kovshenin
11 years ago

  • Cc kovshenin added
  • Keywords editorial-flow added

This might be fixed by the work on post statuses in 3.6. See #23168

#12 follow-up: @wonderboymusic
11 years ago

  • Keywords needs-patch performance added; dev-feedback featured editorial-flow removed

just ran some tests: with any OR for post_status, it's about 2ms slower than just post_type = 'publish'

#13 in reply to: ↑ 12 @nacin
11 years ago

  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Replying to wonderboymusic:

just ran some tests: with any OR for post_status, it's about 2ms slower than just post_type = 'publish'

An EXPLAIN is going to be more informative than raw speed.

I'm going to close this as maybelater. It is realistically a duplicate of #12706, otherwise.

Note: See TracTickets for help on using tickets.