Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#7120 closed enhancement (fixed)

Remove WordPress DB lookups on BuddyPress single pages

Reported by: r-a-y Owned by: djpaul
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch early commit
Cc: espellcaste@…

Description

#WP36687 is a really interesting ticket that allows developers to bail from the WP_Query to provide their own matches.

Since BuddyPress single pages do not rely on a WordPress page, we can remove some DB queries here.

These changes will land in WP 4.6. So maybe we can add these enhancements in 2.7.

Attachments (1)

7120.01.patch (1.3 KB) - added by r-a-y 3 years ago.

Download all attachments as: .zip

Change History (12)

@r-a-y
3 years ago

#1 @r-a-y
3 years ago

  • Component changed from API - Rewrite Rules to API - WordPress
  • Keywords has-patch early added
  • Milestone changed from Under Consideration to 2.7

#2 @espellcaste
3 years ago

  • Cc espellcaste@… added

That's an interesting change @r-a-y.

Have you had a change to test the performance improvements with this change?

#3 @r-a-y
3 years ago

Have you had a change to test the performance improvements with this change?

Yes, as I note in the inline doc, it removes one DB query when you are on a user's profile or single group page.

One is better than nothing :)

#4 @espellcaste
3 years ago

I agree! Every bit counts! =)

#5 @DJPaul
3 years ago

  • Component changed from API - WordPress to Core

#6 @DJPaul
3 years ago

What does this look like in terms of backwards compatibility?

#7 @r-a-y
3 years ago

What does this look like in terms of backwards compatibility?

The 'posts_pre_query' filter is going to be introduced in WordPress 4.6, so this change doesn't affect those using < WP 4.6.

#8 @DJPaul
3 years ago

  • Keywords commit added

Let's do it. I think the add_filter should be moved into core/actions.php, as that's the point of that file, and it'd make it clearer to other plugins what we're doing here.

#9 @djpaul
3 years ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 11007:

Core: prevent DB query for WP's main loop on single item pages.

As of WordPress 4.6, it is possible to bypass the main WP_Query entirely.
This saves us one unnecessary database query.

Fixes #7120

Props r-a-y, DJPaul

#10 @DJPaul
3 years ago

I tweaked some names a bit, and added support for the activity single item screen in, too.

#11 @r-a-y
3 years ago

In 11099:

Core: Fix conditional logic when preventing WP's main query on single BuddyPress pages.

This commit correctly uses the conditional as recommended in the original
patch. (See r11007.)

See #7120

Note: See TracTickets for help on using tickets.