Migration of content between different blog types in Wordpress

0

Good morning,

I am currently working on a project for a news portal that is the grouping of 4 different companies, however one of these companies will cease to exist and all its posts will be transferred to another company within the portal.

To make the separation between the companies within the admin I am using the standard post type of WordPress (post) and 3 more custom posts for the other houses. The company that will cease to exist is using the default post type of WordPress.

The content migration (post post) between the standard post type and custom post I have already done via direct query in the database and is ok.

However, the content stays with the old categories and I need to update with the categories as well.

For example:

Suppose I have the following categories in the company that will be extinguished:

  • Company 1 (parent category)
    • Policy (daughter category)
    • Cities (daughter category)
    • Sport (daughter category)

And the following categories in custom post

  • Company 2 (parent category)
    • Policy (daughter category)
    • Cities (daughter category)
    • Sport (daughter category)

When I created a news post in the standard WordPress post I assigned the post to the categories Company 1 - > Policy.

After the change I need to change the reference that was previously Company 1 - > Policy for Business 2 - > Policy.

For the custom post I'm using a specific custom category because of the project's business rules.

To try to understand how WordPress works when I select a category for a post I was observing the mysql query log, but I was not able to take much advantage of this approach, I searched for plugins that could help me and the ones I found made a "merge" between categories. For reference the links of the plugins follow below:

Batch-Move Posts wp plugin

Term Management Tools

This category migration is important because it is the categories that identify which company the news is from.

The only way I could see of doing this update is via SQL query directly in the database, but the queries I executed did not work.

Here is a reference of two of the queries executed:

UPDATE wp_relationships SET term_taxonomy_id = 270 WHERE term_taxonomy_id = 380;

UPDATE wp_term_relationships SET term_taxonomy_id = (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id = 340) WHERE term_taxonomy_id = (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id = 112747);
    
asked by anonymous 13.01.2016 / 17:31

0 answers