I'm trying to make a category change of some posts by MySQL.

But I am not able to give the update in the database, it is giving error when running the query.

FROM mooca_posts
LEFT JOIN mooca_term_relationships ON (mooca_posts.ID = mooca_term_relationships.object_id)
LEFT JOIN mooca_term_taxonomy ON (mooca_term_relationships.term_taxonomy_id = mooca_term_taxonomy.term_taxonomy_id)
SET mooca_term_taxonomy.term_id = '112'
WHERE mooca_term_taxonomy.term_id IN (1448)
GROUP BY mooca_posts.ID

I need to change from category 1448 to 112.

1 Answer 1

UPDATE wp_term_relationships 
  SET term_taxonomy_id = 112
WHERE term_taxonomy_id = 1448

Try this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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