[ad_1]
Hi. I am trying to set the query post per page to -1 for all queries but it is causing problems in the admin panel.
currently my code is
add_action( 'pre_get_posts', 'custom_query_vars' );
function custom_query_vars( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
$query->set( 'posts_per_page', -1 );
}
}
but this is not correctly setting the posts per page in my query.
When I remove the && $query->is_main_query() then the query displays all posts, as intended, but while editing pages the admin panel does not show reusable blocks and the query loop preview does not load anything.
Any ideas about how I may be able to achieve setting the posts per page to -1 for all queries on the site without these undesirable effects?
The page I need help with: [log in to see the link]
