Let's Embrace
Paris Olympic 2024..!


25% OFF

WP Ultimate CSV Importer PRO

Promo Code


How to import CSV files in WordPress without a plugin

import CSV files in WordPress without plugin

If you’re planning to transfer content to your WordPress site and wondering if it’s possible to do so without a plugin, then the answer is a resounding yes!

Fortunately, WordPress offers several built-in options that allow you to import without relying on a third-party plugin. Moreover, it also supports various file types that cater to your specific needs.

In this tutorial, we’ll guide you through the step-by-step process of importing programmatically to WordPress without the use of a third-party plugin.

Warning 1: Backup Before You Proceed

It is always important to back up your data regularly before you do something that updates the database whether you use a plugin or not. This ensures that you have a safe backup copy of your website’s content and database so that you can always roll back to a previous version in case of any issues, data loss, or corruption.

Warning 2: Potential Risks Involved

Importing content without a plugin can potentially cause issues with themes or other plugins, and break the functionality or design issues. It also increases the risk of security vulnerabilities if the content with malicious code or scripts gets injected while importing.

How to use WordPress functions

Do you want to import many posts into your site but don’t want to do it manually one by one? Well, you’re in luck because I have a solution for you!

One way to import posts as CSV is by using the built-in wp function called wp_insert_post(). This function allows you to programmatically create and insert them into the database.

Here’s how you can use this function:

First, make sure your file is uploaded to your server or host through ssh, cpanel, ftp, or sftp, for example in the directory /var/www/html/wp-content/uploads/posts.csv.

Next, add the following code snippet to your theme’s functions.php file e.g: wp-contentthemestwentytwentythreefunctions.php

if (($handle = fopen("/var/www/html/feb/wordpress/wp-
content/uploads/smack_uci_uploads/imports/d107020a28796c63d6984ad91f0fcab5/post.csv", "r")) !== FALSE) {
 // Read the CSV file line by line
 while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
 // Create a new post object and set its properties
 $post = array(
 'post_title' => $data[0],
 'post_content' => $data[1],
 'post_status' => 'publish',
 'post_type' => 'post',
 // Insert the post into the database
 $post_id = wp_insert_post($post);
 // Check if the post was inserted successfully
 if ($post_id > 0) {
 // Post was inserted successfully, do something else if needed
 } else {
 // Post was not inserted, handle the error if needed

Save the changes to your functions.php file.

You can also edit the theme file from Appearance > Theme File Editor

wordpress theme file editor

When you run a page URL in the browser, the import will be triggered and processed automatically. You can view it from the wp-admin panel to check if all the records were inserted successfully.That’s it! You are done now.Keep in mind that this is just a basic example, and you can modify the code to suit your specific needs. For example, you can add additional code to handle custom post types, taxonomies, or other properties. Also, you can customize to use the code snippet in any filter or action hook based on your trigger function. If you need more help or would like to see more use cases, additional examples, and code snippets, do not hesitate to reach out to us! You can leave a comment below or use the contact form, and we’ll be happy to update the tutorial with more information to help you out.

How to use the wp-cli method

Another method to import users from CSV without a plugin into WordPress is by using wp-cli. This method is pretty straightforward to follow. First, you need to prepare a file in a specific format, which should look something like this:

 Johndoe,[email protected],John Doe,contributor,create
 smacksupport,[email protected],smackcoders,administrator,create
 jiju2fabio,[email protected],jiju2fabio,author,create

You can create or update your user CSV file to match this structure. If you want to use the same sample that we’ve used in this tutorial, you can download it for training purposes. Once you have your file ready, upload it to your uploads folder, and the path to the file should be /var/www/html/wp-content/uploads/users.csv.

Assuming you have already installed wp-cli, you can use the following WP-CLI command:

wp user import-csv /var/www/html/wp-content/uploads/users.csv

And that’s it! Your users should be imported now. You can also upload the file from a remote URL using this method.

However, it’s important to note that this method is only useful for users as CSV. If you’re looking to import posts from CSV, the wp function method is the better option. The wp-cli method is only compatible with WXR files, which can be complicated. So, if you want to import posts, it’s best to stick with the first method we discussed.

WP Ultimate CSV Importer Pro

WP Ultimate CSV Importer Pro

Get Ultimate CSV/XML Importer to import data on WordPress faster, quicker and safer.

WordPress Export custom post type to CSV without a plugin

It is easy to export the custom post type to CSV directly from WordPress without any third-party plugins.

Here are the simple steps to follow:

Login to your WordPress Account.

Navigate to the Tools at the Left side menu and select Export.

export post type tools

All the post types will be listed. Among, Select the desired custom post type that you want to export.

custom post type selection for

Then click on Download Export File.

download export file

How to use the Built-in Options

First, log in to your wp-admin dashboard and go to the Import section under Tools. Scroll down until you see the WordPress option and click “Install now”. Once it’s installed, you’ll see a new option called “Run Importer”. Click on that to start the process. 

buildin run importer wordpress

Next, you’ll be prompted to upload the WXR (.xml) file. This is the file that contains all the content you want to bring to your site. 

upload wxr file all import wordpress

Once you’ve uploaded the file, you’ll see the “Assign Authors” section. Here, you can choose how to handle author information. You can import authors, create new users, or assign them to already available users. Make sure to review and adjust the settings as needed. You can also choose to download any attachments that are included in the file.

Once you’ve configured all the settings, click “Submit” to start the process. The tool will process the WXR file and import the content. If any errors occur during the process, you’ll be notified so you can address them.

And that’s it! With this built-in tool, importing content has never been easier. No need for other plugins or custom code.

Know about Built-in WordPress All Import Options

Well, Did you know that WordPress has other built-in options that you can use for this purpose?

To access these built-in tools, all you need to do is go to your WP-Admin dashboard, click on “Tools,” and then select “Import.” From there, you’ll see a table with different options available. Depending on your needs, you can choose the option that suits you best. For example, if you want to migrate from a Blogger blog, you can use the Blogger option. If you want to import from an RSS feed, you can use the RSS option. If you want to transfer from an export file in WXR format, which supports posts, pages, comments, custom fields, categories, and tags, you can choose the WordPress run importer option.

However, keep in mind that these default tools have some limitations. You can only use them for a one-time process, and you cannot automate or schedule the process. Also, filters and partial imports may not work correctly, and there is no proper support or fixes available.

But don’t worry, if you need more robust and reliable tools, there are third-party plugins like WP Ultimate CSV Importer available that can help you out. Here are some plugins you can try

WordPress import users from CSV without a plugin

Follow the below basic steps to import users from a CSV file into WordPress without using a plugin. This involves writing custom code using PHP and WordPress functions. Please note that this example assumes a basic CSV structure with headers like username, email, and password. 

Prepare Your CSV File

First, create a CSV file with user data, including headers (e.g.username, email, password).

Save the CSV file in a location accessible by your WordPress installation.

Create a Custom PHP Script

Once you create a CSV file, then create a  custom PHP script in your WordPress theme or the root of your WordPress installation (e.g.,import-users.php).

Write PHP Code for Import

Finally, open your custom PHP script and use the following code to import users from the CSV file.


// Include WordPress functions

define(‘WP_USE_THEMES’, false);


// Path to your CSV file

$csvFilePath = ‘path/to/your/users.csv’;

// Function to create a new user

function create_user($username, $email, $password) {

$user_id = wp_create_user($username, $password, $email);

if (is_wp_error($user_id)) {

echo ‘Error creating user ‘. $username . ‘: ‘ . $user_id->get_error_message() . ‘<br>’;

} else {

echo ‘User ‘ . $username . ‘ created successfully.<br>’;



// Read CSV file

if (($handle = fopen($csvFilePath, ‘r’)) !== false) {

while (($data = fgetcsv($handle, 1000, ‘,’)) !== false) {

$username = $data[0];

$email = $data[1];

$password = $data[2];

// Check if the user already exists

$user_exists = username_exists($username);

if (!$user_exists) {

create_user($username, $email, $password);

} else {

echo ‘User ‘ . $username . ‘ already exists.<br>’;




} else {

echo ‘Error opening CSV file.<br>’;


Run your Script

Then access your script via a web browser (e.g., http://yourdomain.com/import-users.php). 

This will execute the script, importing users from the CSV file.

How to plan a simple migration

If you’re planning to import your data, it’s essential to plan well before getting started. Let’s discuss some takeaways that can help you choose the right option. 

Firstly, if you want to import user metadata as CSV, you can do it programmatically using wp-cli without the need for any plugin. Secondly, you can use the WP function method by customizing the shared code to your specific needs. If you have WooCommerce installed and active, you can import products and tax details as CSV without needing another plugin. 

If you’re planning to use WXR, you can use the wp-cli method, but it requires more effort and time. The easiest way is to use the default importer option.

Moreover, there are other options available for bloggers, Tumblr, LiveJournal, Movable Type, TypePad, etc., and from an RSS feed as well. Understanding each option’s capabilities and limitations can help you choose the right option for your needs.

Also, It’s important to know about each file type that WordPress supports. Let me explain each file type in detail so that you can understand it better.

  • WXR: It stands for WordPress eXtended RSS. It is an XML-based file format that contains content, categories, and tags. It is the most common file format used for importing and exporting data.
  • XML: It stands for eXtensible Markup Language. It is a file format that is used to store and transport data. WordPress uses XML to export and import content.
  • CSV: It stands for Comma Separated Values. It is a file format that stores data in a tabular form where each column is separated by a comma. CSV files are commonly used to store data like product information, user data, and more. 
  • RSS: It stands for Really Simple Syndication. It is a file format used to publish frequently updated content. It also allows you to import RSS feeds into your site. JSON: It stands for JavaScript Object Notation. It is a file format used to store and exchange data.

So, those are the file types supported. It’s important to choose the right file format based on your data and requirements. 

I hope this information helps you. Some useful References: If you want to learn more about the WP-CLI method, you can visit the WP-CLI website. For using the WP function method, you can use the wp_insert_post() function. This function allows you to programmatically insert data into your WordPress site. You can learn more about it from the WP developer reference.

Why the CSV Importer plugin is better for Quality content Import?

Importing CSV files into a website or application is a common task, especially in content management systems like WordPress. Though it’s possible to import CSV files manually or without a plugin, using a dedicated CSV importer plugin offers several advantages and can be crucial for efficiency, accuracy, and data integrity.  

Here’s Why the CSV importer plugin is important:

Automated Processing: WP Ultimate CSV importer is a dedicated plugin that  automates the import process, eliminating the need for manual data entry or manipulation. With CSV importer, you can handle large datasets efficiently and perform tasks such as data validation, formatting, and normalization automatically, saving time and effort.

Structured Data Mapping: CSV importer plugins typically provide an interface for mapping CSV file columns to specific fields or data structures within the website or application. This structured approach ensures that data is imported correctly and consistently, reducing the risk of errors or misinterpretations.

Customization and Extensibility: The WP CSV importer plugin offers customization options and extensibility through hooks, filters, or custom scripting. This flexibility enables developers to customize the import process to specific requirements, integrate with other systems or plugins, and implement custom data transformations or validations.

Support for Complex Data: Importing CSV files with complex data structures or hierarchical relationships can be challenging without a dedicated Importer. CSV importer plugin can handle nested data, multi-level taxonomies, custom post types, and other advanced scenarios more effectively, ensuring that all data is imported accurately and in the desired format.

User-Friendly Interface: CSV importer plugins typically provide user-friendly interfaces that simplify the import process for administrators and content editors. They offer guided workflows, error notifications, and feedback mechanisms to streamline the import process and empower users to manage data effectively without technical expertise.

Security and Performance: Dedicated CSV importer plugins are designed with security and performance considerations in mind. They adhere to best practices for data sanitization, access control, and resource management, minimizing security risks and optimizing performance during the import process.

Updates and Maintenance: Using a reputable CSV importer plugin ensures ongoing updates, maintenance, and support from the plugin developer or community. This helps mitigate compatibility issues, address security vulnerabilities, and ensure compatibility with the latest versions of the underlying platform or dependencies.

In summary, while it’s technically possible to import CSV files manually or without a plugin, using a dedicated CSV importer plugin offers numerous benefits in terms of efficiency, accuracy, data integrity, and user experience. Whether you’re importing product listings, user data, content, or any other type of information, leveraging a CSV importer plugin can streamline the process and mitigate potential risks associated with manual import methods.

How to Use a WP CSV Importer Plugin?

Using a WP CSV importer plugin is straightforward and involves the following steps:

Install and Activate the Plugin: Install the WP Ultimate CSV importer Plugin and Activate it

Prepare Your CSV File: Ensure that your CSV file is properly formatted and contains the data you want to import. You may need to adjust column headers or data formatting to match the requirements of your website or application.

Access the Importer Interface: Navigate to the CSV importer plugin’s interface within your WordPress dashboard.

csv importer

Map CSV Columns to Data Fields: On the import section map CSV columns to specific data fields within your website or application. This typically involves selecting the corresponding data field or attribute for each CSV column.

WP Ultimate CSV Importer Pro

WP Ultimate CSV Importer Pro

Get Ultimate CSV/XML Importer to import data on WordPress faster, quicker and safer.

Configure Import Settings: Configure any additional import settings such as data validation rules, import behavior (e.g., replace existing data), and error handling preferences.

Execute the Import Process: Once you’ve configured the import settings and mapped CSV columns to data fields, initiate the import process. The WP CSV importer plugin will parse the CSV file, validate the data, and import it into your website or application according to the specified settings.

import and export Import configuration settings

Review Import Results: After the import process is complete, review the import results to ensure that the data was imported successfully and no errors occurred. Many CSV importer plugins provide detailed logs or reports that summarize the import process and highlight any issues encountered.

Beyond Basic Imports: Advanced Features and Use Cases

While CSV importer plugins excel at basic data imports, they also offer advanced features and capabilities that extend their utility and versatility. Some examples include

  • Scheduled Imports: Schedule recurring imports to automatically update content or data from external sources at specified intervals.
  • Custom Field Mapping: Define custom mapping rules for complex data structures or hierarchical relationships.
  • Integration with External Systems: Integrate with third-party APIs, databases, or services to import data from external sources directly into your website or application.
  • Batch Processing: Import large datasets in batches to optimize performance and resource utilization.
  • Data Transformation and Validation: Implement custom data transformations or validation rules to clean and normalize imported data.
  • Merge and Deduplication: Merge or deduplicate imported data to ensure data consistency and eliminate duplicate entries.


Lastly, if you want to use the WordPress default options, you can find them in the plugin repository. In conclusion, importing content can be made easy with the right tools, an understanding of the available options, and knowing the limitations and capabilities of each option.  Though there are options to import CSV into WordPress without a plugin, it involves a lot of manual work and time.  Always using an Ultimate CSV Importer plugin is an easy way to get results in a few simple clicks.

With these tips in mind, you can transfer your content seamlessly and focus on creating quality content for your website.