[wp-hackers] how to unassing category from the post?

Rafael Ehlers rafaehlers at gmail.com
Fri Mar 25 13:46:20 UTC 2011

I think that you should do something like this:

1. List all categories from a post and assign then to an Array
2. unset the ID from the category you wish to remove
3. wp_update_post( array('ID' => $post->ID,'post_category' =>

Best regards,
Rafael Ehlers

On Fri, Mar 25, 2011 at 10:27 AM, Konrad Karpieszuk
<kkarpieszuk at gmail.com>wrote:

> hello
> suppose that post with ID 4 belongs to category with ID 12, but also
> belongs to many other categories.
> is some easy function in wp core to unassign post from particular one
> category?
> now in my plugin i am thinking about using wpdb class to update some
> term relationship but i am feeling that this is not the best way
> --
> (en) regards / (pl) pozdrawiam
> Konrad Karpieszuk
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list