Skip to:
Content
Pages
Categories
Search
Top
Bottom

Issue with Canonical Redirects for BuddyPress URLs


  • Sasan
    Participant

    @sizadbakhsh

    Hello,

    I’ve encountered an issue with canonical redirects when using BuddyPress on a site that also has WPML installed. It seems that the redirect_canonical() function is not being correctly executed during the normal page load process for BuddyPress pages. As a result, URLs without www are not properly redirecting to the correct www version.

    To temporarily resolve the issue, I manually called the redirect_canonical() function within the template_redirect hook, which fixed the problem. However, it appears that there is a bug or conflict within BuddyPress that prevents this function from being automatically executed as expected.

    Please note that the site also uses WPML, which may or may not be contributing to the issue. However, the problem persisted even when focusing on BuddyPress URLs.

    Please investigate this issue, as other users with similar setups may also be affected.

    Code used for the temporary fix:
    /////////////////////////////////
    add_action(‘template_redirect’, function() {
    if (!is_admin()) {
    $redirect_url = redirect_canonical();
    if ($redirect_url) {
    wp_redirect($redirect_url, 301);
    exit;
    }
    }
    });
    /////////////////////////////////
    Thank you for your attention to this matter.

    Best regards,

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar