bp_core_fix_wpml_redirection( array $q )
Add fix for WPML redirect issue
Description
Parameters
- $q
-
(Required)
Return
(array)
Source
File: bp-core/compatibility/bp-incompatible-plugins-helper.php
function bp_core_fix_wpml_redirection( $q ) {
if (
! defined( 'DOING_AJAX' )
&& ! bp_is_blog_page()
&& (bool) $q->get( 'page_id' ) === false
&& (bool) $q->get( 'pagename' ) === true
) {
$bp_current_component = bp_current_component();
$bp_pages = bp_core_get_directory_pages();
if ( 'photos' === $bp_current_component && isset( $bp_pages->media->id ) ) {
$q->set( 'page_id', $bp_pages->media->id );
} elseif ( 'forums' === $bp_current_component && isset( $bp_pages->members->id ) ) {
$q->set( 'page_id', $bp_pages->members->id );
} elseif ( 'groups' === $bp_current_component && isset( $bp_pages->groups->id ) ) {
$q->set( 'page_id', $bp_pages->groups->id );
} elseif ( 'documents' === $bp_current_component && isset( $bp_pages->document->id ) ) {
$q->set( 'page_id', $bp_pages->document->id );
} else {
$page_id = apply_filters( 'bpml_redirection_page_id', null, $bp_current_component, $bp_pages );
if ( $page_id ) {
$q->set( 'page_id', $page_id );
}
}
}
return $q;
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.