Link to home
Start Free TrialLog in
Avatar of Tim Brocklehurst
Tim BrocklehurstFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Importing a commer-separated list of values into Wordpress. How to convert them to tags?

We have written an app which syncs a SQL Db with the MySQL Db behind a Wordpress Site.
It therefore populates, and updates custom post types - and their fields - in Wordpress.

One of the fields in the SQL Db (called marketing-tags) carries a list of terms. Each one separated by a semi-colon ";"

Wordpress uses no less than three tables to manage tags and categories (taxonomies) for a site. We could write an extension to the app which will separate the values in marketing-tags look up each of them in the wp_terms table to check they exist, add them if not, or if they do, make the association with the current post.

However, before we set about writing the code to do that, does anyone know of a Wordpress plugin, or a pre-written function, which we can use to do it more quickly?

Thanks
Avatar of William Nettmann
William Nettmann
Flag of South Africa image

The WP All Import plugin does all that sort of stuff - you could just export all your SQL data to a file, dump it in a folder and let WP All Import import it using a cron.

That would include the actual posts as well.
Avatar of Tim Brocklehurst

ASKER

Hi William

Thank you for your response, and the suggestion of WP All Import.
I should explain, the purpose for the app we created has been to bypass the need for manual imports using WP All Import. The client has had this plugin in operation for the past three years, however it has required a backwards/forwards sync in order to manage the correct import of child posts and have them reference the parent postID.

Our solution makes a direct connection to the product SQL Db and updates Wordpress' MySQL's wp_posts and wp_postmeta tables every hour so the website is consistent with the company's in-house product Db.

We had been seeking a similarly automated method by which the tags could be separated from the 'marketing-categories' CPT which stores them and adds them individually to the relevant tables in WP so they appear as tags.

Unless you know a way in which WP All Import can be configured and scheduled to do this, it looks like we'll need to extend our coding to include a separate tags import too.
SOLUTION
Avatar of William Nettmann
William Nettmann
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial