[wp-hackers] Plugin to update all posts in a category

Callum Macdonald lists.automattic.com at callum-macdonald.com
Mon Feb 26 04:20:45 GMT 2007


G'day,

I'm working on a plugin to update the custom fields of an entire 
category of posts in one go.

For example, I have a category called photos to which I add all posts 
that have photos. If I wanted to add a new tag to these posts (stored in 
a custom field) then I'd go to my plugin page, select the category, and 
choose the option, "add a tag to this category".

I'm having a few challenges that I'd appreciate any pointers on.

1) I'd like to list the categories as a drop down menu, so one can be 
selected, with the category id as the value. I''m looking at the 
wp_list_categories function, but I don't think that's what I want.

2) I want to get a list of all the post ids from a single category. 
Again I'm looking at template tags, but I'm sure there must be a better way.

3) I plan to use a foreach loop to circle through each post and then use 
the update_post_meta() function. Any feedback on this approach would be 
great.

The plugin will be under the GPL licence and I'll be happy to upload it 
to wp-plugins.net and so on.

Cheers,


Callum.



More information about the wp-hackers mailing list