Opened 4 years ago
Closed 3 years ago
#8429 closed enhancement (fixed)
Fire a hook when non-BP page is detected
Reported by: | Gabe462 | Owned by: | imath |
---|---|---|---|
Milestone: | 10.0.0 | Priority: | normal |
Severity: | normal | Version: | 7.1.0 |
Component: | Core | Keywords: | good-first-bug has-patch commit |
Cc: |
Description
at /src/bp-core/bp-core-catchuri.php:252
I'd like there to be a do_action( 'bp_not_a_buddypress_page' );
<?php 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.
Attachments (1)
Change History (12)
#2
@
4 years 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
@
4 years 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: https://codex.buddypress.org/participate-and-contribute/contribute-with-code/
#5
@
4 years 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.
#6
@
4 years 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
@
4 years 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
@
4 years 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.
@
3 years ago
Hi, I am also looking for something like this then found this ticket. It would be nice if you decided to add this. I created a patch as you mentioned earlier.
Hello @Gabe462! 👋
Something like this seems like a pretty neat idea. I am +1.