I am experiencing the similar issues. BuddyPress by default “hijacks” the WordPress search, and searches seem to only be applied against my BP pages – which are few. I need my WordPress search back.
If there isn’t a way to include both (and given my Google searches, there doesn’t seem to be,) is there a way to disable BuddyPress search completely?
Hi Roquefort.
After I posted this I investigated the source code and came to the same conclusion as you. BuddyPress does take over WordPress search and causes any other WordPress search (including the inbuilt one) to stop working.
I did however find a work around! What happens is buddypress defines a search slug that is the same as WordPress. What you have to do is redefine the buddypress search slug to something else and your search will start working again.
Basically you want to put the following in your wp-config.php
`define( ‘BP_SEARCH_SLUG’, ‘bpsearch’ );
I tried to load this further up the stack to try and override this but wp-config seemed to be the only place this worked.
You can find out more about how I worked this out over at this post:
BuddyPress and WordPress Search
Hi @digitalchild
I just read your blog post. It’s interesting you couldn’t get define( 'BP_SEARCH_SLUG', 'searchresults' );
to work outside of wp-config.php. Have you tried creating a bp-custom.php file and popping the constant definition in there?
Ref: https://codex.buddypress.org/plugindev/bp-custom-php/
Thanks for the quick response guys! I followed @digitalchild ‘s instructions, and search now does what I want it to!
Hi @henrywright
It appears bp-custom does work now! I must have been doing something wrong. I’ve put it in the top of my existing bp-custom.php and its working. I prefer putting this here. Thanks for the tip.
I’ll update my blog post to note this.
@roquefort Check my blog post in a few minutes this will reflect a better way to do this.
thanks.