Let current user know pending posts counts using wp_query
As others have already noted in the comments, using “posts_per_page” => 5, is better option than “posts_per_page” => -1, for your query as it will give you the information you need for your conditional check. Limiting what is queried is also something to consider – as honk31 mentioned. Along ‘fields’ => ‘ids’ you can also … Read more