Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/30/2022 08:04:47 PM (3 years ago)
Author:
imath
Message:

Avoid querying for comments when viewing a BuddyPress page in TT3

The Twenty Twenty-Three block theme is using the core/comments block to
display comments for WP Pages or Posts. After checking if comments are
open, this block is doing an additional comment count query which wrongly
returns the site's all comment count as BuddyPress pages ID is reset to
0.

In this case forcing comments to be closed is not enough, we also need to
force the comment count to be 0.

See #8744 (trunk)

--Cette ligne, et les suivantes
ci-dessous, seront ignorées--

M src/bp-core/bp-core-filters.php
M src/bp-core/bp-core-theme-compatibility.php

File:
1 edited

Legend:

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

    r13322 r13332  
    7878// Turn comments off for BuddyPress pages.
    7979add_filter( 'comments_open', 'bp_comments_open', 10, 2 );
     80
     81// Force comments count to be 0 or comments list to be an empty array.
     82add_filter( 'comments_pre_query', 'bp_comments_pre_query', 10, 2 );
    8083
    8184// Prevent DB query for WP's main loop.
Note: See TracChangeset for help on using the changeset viewer.