[resolved] get_posts() doesn't work when category is specified (2 posts)

  1. zimmi88
    Posted 7 years ago #

    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 http://new.pastebin.ca/1375334.

    Any help anyone can provide in this matter is greatly appreciated. Thank you in advance for your help!

  2. zimmi88
    Posted 7 years ago #

    Following up on this issue, I worked with a friend to determine that the issue is a compatibility error with get_posts(), which doesn't seem to work when given a query that includes both a category and a tag. Given this, I have gone back and am using an alternate attribute for my queries.

Topic Closed

This topic has been closed to new replies.

About this Topic