[buddypress-trac] [BuddyPress Trac] #7555: BuddyPress Canonical Redirects and Trailing Slashes
buddypress-trac
noreply at wordpress.org
Fri Jun 30 05:12:31 UTC 2017
#7555: BuddyPress Canonical Redirects and Trailing Slashes
--------------------------+-----------------------------
Reporter: MegaZ | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: Awaiting Review
Component: Core | Version: 2.8.2
Severity: normal | Keywords: needs-patch
--------------------------+-----------------------------
Hello,
By default, BuddyPress adds a trailing slash to all slug pages, no matter
what Permalink structure is set in WordPress. While this works well for a
typical WordPress permalink structure like "/%postname%/" if I change my
permalink structure to get rid of the trailing slash like "/%postname%"
then BuddyPress does not take this into account and still continues to
keep all the content with a trailing slash at the end. As a result, URLs
such as the members page that are not supposed to have trailing slashes
will still contain them, such as "/members/", whereas it is supposed to be
just "/members".
The issue lies in the bp_get_canonical_url function within the bp-core-
catchuri.php file, where one single line always forces trailing slashes on
all URLs:
`url_stack[0] = trailingslashit( $url_stack[0] );`
Instead of doing this, why not change the function to
"user_trailingslashit", so that the slash is removed or added based on the
permalink structure? Once done, the code properly redirects the user to
the right URL and does not generate the unnecessary trailing slash.
It seems like BuddyPress employs such techniques in a number of areas
where the function utilizes link generation. I wonder why the development
team went this route, instead of staying consistent with the WordPress
permalink structure.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7555>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list