bbp_remove_adjacent_posts()

Remove “prev” and “next” relational links from <head> on bbPress pages.

Description

WordPress automatically generates these relational links to the current page, but bbPress does not use these links, nor would they work the same.

In this function, we remove these links when on a bbPress page. This also prevents additional, unnecessary queries from running.

Source

File: bp-forums/core/theme-compat.php

1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
function bbp_remove_adjacent_posts() {
 
    // Bail if not a bbPress page
    if ( ! is_bbpress() ) {
        return;
    }
 
    // Remove the WordPress core action for adjacent posts
    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 );
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.0 BuddyBoss 1.4.0
2.6.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.