Skip to:
Content

BuddyPress.org

Changeset 8511


Ignore:
Timestamp:
06/14/2014 06:27:52 PM (5 years ago)
Author:
r-a-y
Message:

Remove "prev" and "next" links when on a BuddyPress page.

WordPress injects these links in the <head> of each WordPress post.
However, BuddyPress doesn't adhere to these links. These links also take
two DB queries on each page load and are uncached.

Therefore, this commit removes these links.

Fixes #4981.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r8453 r8511  
    17031703add_action( 'wp_footer', 'bp_core_print_generation_time' );
    17041704
     1705/**
     1706 * Remove "prev" and "next" relational links from <head> on BuddyPress pages.
     1707 *
     1708 * WordPress automatically generates these relational links to the current
     1709 * page.  However, BuddyPress doesn't adhere to these links.  In this
     1710 * function, we remove these links when on a BuddyPress page.  This also
     1711 * prevents additional, unnecessary queries from running.
     1712 *
     1713 * @since BuddyPress (2.1.0)
     1714 */
     1715function bp_remove_adjacent_posts_rel_link() {
     1716    if ( ! is_buddypress() ) {
     1717        return;
     1718    }
     1719
     1720    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
     1721}
     1722add_action( 'bp_init', 'bp_remove_adjacent_posts_rel_link' );
     1723
    17051724/** Nav Menu ******************************************************************/
    17061725
Note: See TracChangeset for help on using the changeset viewer.