Creating content can be a hard task, but it doesn’t have to be as difficult as you might think. Sometimes WordPress failed to import images or media documents, or other files that are needed for web pages and posts.
When you’re publishing a blog post, you receive an error that says “WordPress Failed To Import Media?” or “Failed To Import The Media You Selected.” This article breaks down the situation and provides five easy resolution tips to help you get back on track.
Why Did WordPress Fail To Import Media? 5 Reasons Why These Errors Happen.
In this article, you will learn the five most common WP errors that occur when importing files from your local computer to your WordPress site. The article outlines what each of these error messages means and, usually, how to fix the problem in less than 5 minutes!
Reason 1: PHP Memory Limited
WordPress gives you the ability to upload a file in sections if you wish to submit a huge file to your website. However, if you are attempting to upload something that is really large, the maximum size for an individual file attachment may be insufficient for the task. This is often the result of PHP’s low memory limit on the size of files that can be uploaded. If you wish to be able to upload files that are larger than a certain size and are hosting your own website, you will need to adjust the Maximum Upload Size setting in cPanel.
TO SOLVE THIS PROBLEM:
Step 1: Access your cPanel dashboard
Step 2: Select PHP Version
The PHP Version can be accessed in cPanel’s Software Area. If not, look at the advanced section. Here, modify your server’s PHP version. choose a PHP version.
Step 3: PHP Options Panel
Step 4: Max Values Set
You’ll then find PHP extensions for the current version.
Scroll down to find the upload_max_filesize, post_max_size, memory_limit, max_execution_time, and max_input_time parameters.
We must increase the value of upload_max_filesize.
Reason 2: File and Folder Permissions
Web hosting providers sometimes upgrade and change file permissions.
If the authorization mode doesn’t allow file uploads, this error may appear:
‘Cannot build wp-content/uploads/20../0. Is the server writable in the parent directory?
TO SOLVE THIS PROBLEM:
Use FTP. Open wp-content/uploads.
Right-clicking it displays ‘File permissions. For all folders and subfolders, set 755.
Right-clicking it displays ‘File permissions. For all folders and subfolders, set 755.
Next, editing uploads file permissions. All files should use 644.
Reason 3: Broken URLs
Many complications arise when transferring WordPress to a new host. After switching, images may not appear properly.
The XML file you upload to WordPress Importer simply contains the file’s URL, not the file itself. This means the importer downloads images from the former site/blog. If the old source is gone, the importer plugin throws an error.
Open the media in your browser to see whether it’s still available. Open the XML file you’d upload in a text editor to obtain the media’s URL. It must have this code:
<script src="https://gist.github.com/codeastrology-dev/40008a4477564a2dec60a8d94f4653c3.js"></script>
Each < item > element’s wp:attachment url> is key.
It includes the old media’s URL.
In this example, the URL is
https://codeastrology.com/wp-content/uploads/image-835634856_324234.jpg?sc=56,
which you can check in your browser.
TO SOLVE THIS PROBLEM:
If you can’t access the file, run the WordPress importer again.
Reason 4: Broken XML File
You might run into problems while attempting to import a massive XML database, demo material from theme imports, or an entire website’s worth of content into WordPress.
TO SOLVE THIS PROBLEM:
Download the file again. So go to the,
WordPress Dashboard >> Tools >> Export >> Download Export File
Reason 5 : Large XML File
You may have updated the file upload size (upload_max_filesize) as well as the max_execution_time and max_input_time, but you still receive the error message. Why?
Because your file is too large. You need to divide the file into small chunks.
TO SOLVE THIS PROBLEM:
Step 1: Text Editor
I use Coda or Sublime Text, but any will do. DO NOT USE MS WORD or other “word processing” programs. It’s a simple text editor like Notepad.
Step 2: Exclude Instructions Lines
Instructions are the first 20 lines. They’re useless.
Critical is the
<?xml version=”1.0″ encoding=”UTF-8″ ?>
tag on the first line.
Content begins where rss version=”2.0″… and channel> tags appear.
Follow the pattern carefully. In addition to the above tags, each line must contain… tags.
Each new part must be tagged as shown:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"...
<channel>
<wp:wxr_version>1.2</wp:wxr_version>
Your 5,000-ish lines of content, starting with <item> and ending with </item>
</channel>
</rss>
You should have numerous item>…/item> tags in 5,000 lines. The import will fail if your content isn’t wrapped in item>…/item> tags.
Step 3: Copy and Paste Tags
Copy and paste these tags into each file’s top and bottom. The process will fail if errors are made.
Step 5: Import Small File
It is time to upload the small files.
Access your admin dashboard then.
Tools > Import > WordPress (Run Importer).
Related Article
Final Thoughts
One of the most frustrating Drupal issues you can experience is failing to import media. In this post, I will go over five reasons why WordPress failed to import your media and how you can overcome them.
If you’re having trouble importing media into your WordPress site, there are a few things you can do to troubleshoot the issue. Here is the summary of the reasons why:
- Your file size is big but your PHP memory is low. So you have to increase the file upload size and also the max execution time.
- You may not have the correct permissions set on your images and videos. Make sure that you’ve granted access to the appropriate files and directories in your WordPress site’s file structure and then try importing again.
- Many complications arise when transferring WordPress to a new host. After switching, images may not appear properly. Because of the broken URL, you have to fix it. The best solution is to clean your cache and re-import them.
- You might have pasted the incorrect file type into your media uploader page. Make sure that you’re using the correct file types when uploading media (.jpg, .gif, etc.), and double-check that all of your files are properly named and numbered.
- WordPress does not allow you to import large XML files. In that case, you have to divide it into small parts,
After reading this article, you should be able to fix WordPress media import errors on your own without having to contact support.