Back to Top

How to import terms from csv in wordpress?

To import terms from csv in wordpress

WordPress is the most popular CMS and with WordPress building a website is very quick and easy. Today I am going to explain about to import terms like (categories, tags, or terms of custom taxonomy) from CSV into WordPress.

Here, I am going to explain code step by step:

First of all, create one file into root folder where you have stored WordPress or you can create into your theme folder. If you create file into theme, you need to change $base_dir value variable.

Next,we will calls csv_to_array function which get data from csv file and convert the data to array. After receiving it as array,calling a function flatter_array converted multidimensional array to single dimension array.

Now, foreach loop to insert one by one data as term into WordPress.

That’s it place above code into the file, your CSV file and replace with your desired taxonomy in wp_insert_term function.

Also Read:

Disable updates for specific plugin in WordPress
To get Last auto increment id in WordPress
To import user from CSV in WordPress

Hope this helps someone else out.As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to set DirectoryIndex using .htaccess?

Posted on 4 years ago

Bhumi

How to Paginate WordPress Taxonomy?

Posted on 5 years ago

Bhumi

An Introduction to Kubernetes

Posted on 2 years ago

Bhumi