wp api – Get a complete list of all categories using node-wpapi

Question

I’m trying to get a complete list of all categories using node-wpapi. But I can not do that.

I use wp.categories(), but it only returns a response containing up to 10 categories.
Actually, there are 12 categories.

The codes I used below.

wp.categories().then( (res) => {
    console.log(res.length);
});
let categories = await wp.categories();
console.log(categories.length);

Both codes above returned 10.

Is there an optional argument or other methods to get a complete list of all categories?
What should I do?

0
Pierogi 2 weeks 2021-07-12T06:37:05-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse