Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/06/2015 03:19:56 PM (5 years ago)
Author:
boonebgorges
Message:

Don't trailingslash the href of subnav items if the 'link' was provided explicitly in bp_core_new_subnav_item().

trailingslashit() is not smart enough to detect links with query params, so
that links can be improperly trailingslashed in some cases. More generally,
it's not the case that all links should be trailingslashed (in particular,
those that do not lead to WP/BP pages), so plugin authors should be responsible
for trailingslashing on their own.

Props pareshradadiya.
See #6353.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-buddybar.php

    r9600 r9701  
    297297    // Link was not forced, so create one
    298298    if ( empty( $link ) ) {
    299         $link = $parent_url . $slug;
     299        $link = trailingslashit( $parent_url . $slug );
    300300
    301301        // If this sub item is the default for its parent, skip the slug
    302302        if ( ! empty( $bp->bp_nav[$parent_slug]['default_subnav_slug'] ) && $slug == $bp->bp_nav[$parent_slug]['default_subnav_slug'] ) {
    303             $link = $parent_url;
     303            $link = trailingslashit( $parent_url );
    304304        }
    305305    }
     
    314314    $subnav_item = array(
    315315        'name'              => $name,
    316         'link'              => trailingslashit( $link ),
     316        'link'              => $link,
    317317        'slug'              => $slug,
    318318        'css_id'            => $item_css_id,
Note: See TracChangeset for help on using the changeset viewer.