New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

How To Load BuddyPress Scripts & Styles Only On BuddyPress Pages

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on #34932

    Hi Tosin,
    It is not feasible to modify the above script(posted by Ravi) for it.

    For BP Legacy, there is no separate js for notifications. BP Nouveau does have a separate js file for notifications but it depends on the buddypress-nouveau.js.
    So, in case of Legacy, you can not have notifications and disable others and same goes for the Nouveau template pack.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    thomdj on #49933

    Hi, I have an edge case use for BuddyPress. I use BuddyPress Member Types Pro to automatically place users in LearnDash groups after registration via a registration codes. Nothing related to BuddyPress is used on the frontend. Is there a way to block all scripts and styles on the frontend of the site?

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on #49936

    Hi, You may use the following code in wp-content/plugins/bp-custom.php.
    It will break any BP dependencies loading scripts/styles on front end though.

    
    /**
     * Disable 'bp_enqueue_scripts' action by unhooking the function.
     */
    add_action( 'plugins_loaded', function () {
    	$priority = has_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts' );
    
    	if ( false !== $priority ) {
    		remove_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts', $priority );
    	}
    } );
    
    

    We are simply making the action ‘bp_enqueue_scripts’ unavailable.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved