Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I just upgraded the List Category Posts plugin from 0.18.3 to 0.21 and my website has failed.

I've determined that the difference causing the failure is that the previous version passes a string parameter to get_posts() while the new version sends the arguments as an array.

The problem is that the default value for post_parent=0 does not seem to have an effect when passed as a string (e.g. "?cat=55&post_parent=0") but it is being applied when the parameter is being passed as an array (e.g. array( 'cat'=>'55', 'post_parent'='0') ).

My posts are post_type='post', for which post_parent should not be applicable. Many of my posts have a post_parent value which is not zero. They were previously batch converted from pages and it appears that the conversion has left the post_parent value with the id of the previous parent page.

As a result of this, all those posts which were previously converted from pages with a parent have disappeared from my category lists.

Can anyone explain why the parameter is being applied as an array and not as a string.

Why is the default value for post_parent 0 fro the plugin, while it is empty for get_posts()?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Since version 0.19, the plugin sends an array to get_posts to support custom taxonomy (see here).

I just uploaded version 0.21.1 with a small bugfix, it doesn't pass the post_parent parameter to get_posts if you didn't set it. Please give the new version a try and let me know if it's working for you.

share|improve this answer
    
That's fixed it! Thanks for the rapid response. I had overcome the problem by doing an update in the posts table within MySQL to set the post_parent to 0 for all posts. However I think that your fix is more robust - leaving unused variables to their WP defaults (Null in this case) makes more sense. –  Neil Sargent Nov 25 '11 at 16:12
    
Sorry you had to go through that trouble! Yeah, the plugin still has some sloppy code I've been fixing when I get the time to code on it. Thanks for using it and reporting the bug! –  Fernando Briano Nov 25 '11 at 17:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.