Skip to:

Opened 8 months ago

Last modified 5 months ago

#8429 new enhancement

Fire a hook when non-BP page is detected

Reported by: Gabe462 Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version: 7.1.0
Component: Core Keywords: needs-patch good-first-bug


at /src/bp-core/bp-core-catchuri.php:252

I'd like there to be a do_action( 'bp_not_a_buddypress_page' );

if ( empty( $matches ) ) {
    do_action( 'bp_not_a_buddypress_page' );
    return false;

This leaves a convenient hook that I'd use for preventing enqueueing of BP assets that aren't used on other parts of the site.

Change History (8)

#1 @johnjamesjacoby
8 months ago

Hello @Gabe462! 👋

Something like this seems like a pretty neat idea. I am +1.

#2 @needle
8 months ago

I'm a +1 on this too for the convenience. IIRC you can test bp_is_blog_page() to achieve the same effect.

#3 @imath
8 months ago

  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to 8.0.0

Sure! Let's do it!

do_action( 'is_not_buddypress' ) might be a better name ;)

@Gabe462 what about building a patch about it and attach it to this ticket ? We have a nice tutorial about how to do it, if needed:

#4 @Gabe462
8 months ago

OK, I will

#5 @r-a-y
8 months ago

I don't think this new hook is necessary. If you want to dequeue assets, hook onto 'wp_enqueue_scripts' as usual and use the is_buddypress() function to determine if the current page is a BuddyPress page, then dequeue anything you do not want loaded.

The proposed hook would still require you to hook onto an action like 'wp_enqueue_scripts' anyway.

Last edited 8 months ago by r-a-y (previous) (diff)

#6 @needle
8 months ago

@r-a-y Whilst I agree with you about there being other methods to dequeue assets (I also posted one above) I can also see that it could be useful to know at the earliest opportunity that it's not a BuddyPress page - and without the possibility that the return values from is_buddyress() or bp_is_blog_page() are being filtered.

#7 @imath
8 months ago

Here's what I suggest, if @Gabe462 builds the patch and add it to this ticket, we include it! Let's reward new contributors 🤩

#8 @imath
5 months ago

  • Milestone changed from 8.0.0 to Awaiting Contributions

Looks like this ticket is not progressing. As it's not a "must have" fix/feature, let's wait for some contributions about it.

Note: See TracTickets for help on using tickets.