P
P
Pavel2020-06-03 13:57:59
WordPress
Pavel, 2020-06-03 13:57:59

Why is WP_Query ignoring categories?

I do a slug replacement in records through a selection

$query = new WP_Query(' posts_per_page=-1, cat=73,74 ');


posts_per_page=-1normally selects all records, but it is catignored so that I do not specify there. How to specify the categories correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Litvinenko, 2020-06-03
@shortcode

As I understand it, your syntax is wrong. it should be something like this

$query = new WP_Query(' posts_per_page=-1&cat=73,74 ');

or
$query = new WP_Query( array( 'posts_per_page' => '-1', 'cat' => '73,74' ) );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question