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

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.