Skip to content
Advertisement

How to send an array of categories and posts in wordpress functions.php?

I make a request to my custom endpoint function in functions.php :

JavaScript

And in return I get an array of posts of an author id :

JavaScript

I want to return all posts and all categories but I get an error :

JavaScript

How can I get All posts and all categories in a single array inside custom function ?

Advertisement

Answer

Ok try this

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement