Changeset 13461 for trunk/src/bp-core/bp-core-rewrites.php
- Timestamp:
- 04/24/2023 02:32:27 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-rewrites.php
r13455 r13461 79 79 */ 80 80 function bp_rewrites_get_slug( $component_id = '', $rewrite_id = '', $default_slug = '' ) { 81 $using_legacy = 'legacy' === bp_core_get_query_parser(); 82 81 83 /** 82 * This filter is used by the BP Classic plugin to force `$default_slug` usage. 83 * 84 * Using the "Classic" BuddyPress means deprecated functions building URL concatening 85 * URL chunks are available, we cannot use the BP Rewrites API in this case & as a result 86 * slug customization is bypassed. 87 * 88 * The BP Classic plugin is simply returning the `$default_slug` to bypass slug customization. 84 * This filter is used to simply return the `$default_slug` to bypass slug customization 85 * when the query parser is the legacy one. 89 86 * 90 87 * @since 12.0.0 91 88 * 92 * @param string $value An empty string to use as to know whether slug customization should be used. 93 * @param string $default_slug The screen default slug, used as a fallback. 94 * @param string $rewrite_id The screen rewrite ID, used to find the custom slugs. 95 * @param string $component_id The BuddyPress component's ID. 89 * @param boolean $using_legacy Whether the legacy URL parser is in use. 90 * In this case, slug customization is not supported. 91 * @param string $default_slug The screen default slug, used as a fallback. 92 * @param string $rewrite_id The screen rewrite ID, used to find the custom slugs. 93 * @param string $component_id The BuddyPress component's ID. 96 94 */ 97 $ classic_slug = apply_filters( 'bp_rewrites_pre_get_slug', '', $default_slug, $rewrite_id, $component_id );98 if ( $ classic_slug ) {99 return $ classic_slug;95 $use_default_slug = apply_filters( 'bp_rewrites_pre_get_slug', $using_legacy, $default_slug, $rewrite_id, $component_id ); 96 if ( $use_default_slug ) { 97 return $default_slug; 100 98 } 101 99 … … 211 209 } 212 210 213 $url = add_query_arg( $qv, $url);211 $url = add_query_arg( $qv, trailingslashit( $url ) ); 214 212 215 213 // Using pretty URLs.
Note: See TracChangeset
for help on using the changeset viewer.