-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I want you to pay attention that pre_get_posts
action in your plugin has an effect on all queries:
add_action('pre_get_posts', 'commentnavi_allcomments');
function commentnavi_allcomments() {
if (intval(get_query_var('comment-all')) == 1) {
set_query_var('comments_per_page', 9999);
}
}
And it throws some unexpected behavior and/or conflicts with other plugins, e.g. https://wordpress.org/support/topic/backend-error-since-version-1-6-4-1/
I'm pretty sure that you should add a couple of conditional tags to target the right query:
add_action('pre_get_posts', 'commentnavi_allcomments');
function commentnavi_allcomments() {
if ( ! is_admin() && is_main_query() && intval(get_query_var('comment-all')) == 1) {
set_query_var('comments_per_page', 9999);
}
}
More information here.
Metadata
Metadata
Assignees
Labels
No labels