get_posts() doesn’t work when category is specified
-
Hi! I’m currently working on a plugin that will manage custom output for the homepage of a site I’m constructing. Unfortunately, I’m having problems with the get_posts() function.
What I would like the code to do is loop through the categories, printing out the posts that are associated with each category and has a specific tag, as specified in the settings. However, as of now, if I specify a ‘category’ in my get_posts() query, I get back no posts. If the ‘category’ option is omitted, the function works as expected (outputs all posts with specific tag in specified order).
I’ve tried placing my options in an array and query string. I’ve tried ‘category_name’ instead of ‘category’. Finally, I’ve tried being extremely explicit with typecasting. Sadly, all of these haven’t done anything.
I’ve pasted the source at https://new.pastebin.ca/1375334.
Any help anyone can provide in this matter is greatly appreciated. Thank you in advance for your help!
- The topic ‘get_posts() doesn’t work when category is specified’ is closed to new replies.