categories - Change the category of all posts in it

admin2025-06-03  3

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.

UPDATE *
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.

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.

UPDATE *
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.

Share Improve this question edited Feb 4, 2019 at 14:45 Sven 3,6841 gold badge36 silver badges48 bronze badges asked Feb 4, 2019 at 12:04 Marcelo TomazMarcelo Tomaz 153 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1
UPDATE wp_term_relationships 
  SET term_taxonomy_id = 112
WHERE term_taxonomy_id = 1448

Try this

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748945174a315045.html

最新回复(0)