Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp-custom code not working

  • Avatar of Marj Wyatt
    Marj Wyatt
    Participant

    @marjwyatt

    The development is running the following versions of software:
    WordPress v3.7.1
    BuddyPress v1.8.1
    Custom BuddyPress theme based on Genesis Framwework v2.0.1

    I have the following code in my bp-custom.php file which I placed in the mu-plugins folder
    add_action( ‘bp_setup_nav’, ‘vm_setup_nav’ );

    function vm_setup_nav() {
          global $bp;
    
          // Remove a menu item
          //$bp->bp_nav['activity'] = false;
    
          // Change name of menu item
          $bp->bp_nav['settings']['name'] = "Password & Cart Settings";
    
          // Change name of menu item
          $bp->bp_nav['groups']['name'] = "Circles";
    }

    It wasn’t working. I changed the plugin location from wp-content/mu-plugins to wp-content/plugins and it didn’t work there either. When I put this same code in the theme’s functions file, it works.

    What am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Try

    add_action( ‘bp_setup_nav’, ‘vm_setup_nav’, 999 );

    Could be that your function is running before BP has created the nav items but in functions.php the items are created

    Avatar of Marj Wyatt
    Marj Wyatt
    Participant

    @marjwyatt

    Thanks. That worked!

    So I’m clear on what fixed it … the “999″ at the end prioritizes the addition of the action? I’ve looked high and low for an explanation of this number. Since I put bp-custom.php in mu-plugins, it probably was executing prior to crating the nav items.

    As long as I have your attention, have you got a link to a tutorial on how to make the dropdown item labels on the wp-admin bar match those in the profile page?

    Thanks again for the fix and thanks, in advance for answering the subsequent questions.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    the number tells WP in what sequence to place your function when an action fires. 999 is just a super high number to force it at the end after everything else.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.