Skip to:
Content

bbPress.org

Changeset 7072


Ignore:
Timestamp:
02/10/2020 08:53:17 PM (5 years ago)
Author:
johnjamesjacoby
Message:

Theme Compat: conditionally unhook adjacent posts.

This commit adds a new function that is used to conditionally unhook a WordPress core action, and is necessary to prevent debug notices from adjacent posts and Theme Compatibility making post_date a 0 value.

Props r-a-y. For 2.6.15, branches/2.6.

Location:
trunk/src/includes/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/actions.php

    r6923 r7072  
    434434add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit',  10 );
    435435
     436// Must be after bbp_template_include_theme_compat
     437add_action( 'bbp_template_redirect', 'bbp_remove_adjacent_posts', 10 );
     438
    436439// Theme-side POST requests
    437440add_action( 'bbp_post_request', 'bbp_do_ajax',                1  );
  • trunk/src/includes/core/theme-compat.php

    r7006 r7072  
    10271027    return (bool) apply_filters( 'bbp_force_comment_status', $retval, $open, $post_id, $post_type );
    10281028}
     1029
     1030/**
     1031 * Remove "prev" and "next" relational links from <head> on bbPress pages.
     1032 *
     1033 * WordPress automatically generates these relational links to the current
     1034 * page, but bbPress does not use these links, nor would they work the same.
     1035 *
     1036 * In this function, we remove these links when on a bbPress page. This also
     1037 * prevents additional, unnecessary queries from running.
     1038 *
     1039 * @since 2.6.0 bbPress (r7071)
     1040 */
     1041function bbp_remove_adjacent_posts() {
     1042
     1043    // Bail if not a bbPress page
     1044    if ( ! is_bbpress() ) {
     1045        return;
     1046    }
     1047
     1048    // Remove the WordPress core action for adjacent posts
     1049    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 );
     1050}
Note: See TracChangeset for help on using the changeset viewer.