From cb7c116251083a8b0c93753d3e9025a41ed24da2 Mon Sep 17 00:00:00 2001 From: "arlemp@selectel.ru" Date: Wed, 17 Aug 2022 13:48:02 +0300 Subject: [PATCH] new limit authors --- functions.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index 6872385..9f1a4f2 100644 --- a/functions.php +++ b/functions.php @@ -664,6 +664,7 @@ add_action( 'init', function () { add_action( 'pre_get_posts', function ($query) { + if ( ! is_admin() && $query->is_main_query() && is_category() ) { // не админка и основной цикл страницы @@ -682,12 +683,16 @@ add_action( 'pre_get_posts', function ($query) { $query->set( 'posts_per_page', 25 ); } - if (is_author()){ - $query->set( 'posts_per_page', 24 ); - } + - } + } + + + if ( !is_admin() && $query->is_main_query() && is_author()) { + $query->set( 'posts_per_page', 24 ); + } + });