Question

I have a post ID and I'm just trying to find a function ( I was thinking of something similar to wp_update_post() ) where I can just pass a post ID and maybe a category ID or slug and have it associate the post to the category. Does that exist or have you seen a plugin doing that where I can peek at what they did?

Was it helpful?

Solution

wp_set_object_terms() is native function that assigns term from taxonomy to post.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top