Fix Blogger Importer Plugin Not Working Errors in these 5 Ways

It’s been a while we wrote about Google blogger platform. The last time we did was about tips for retaining traffic after moving from blogger to WordPress. Even though we’ve discussed the 7 blogger to WordPress migration plugins before, we’ll still like to talk about the possible fixes for default Blogger Importer plugin.

This post would come in handy for those who are having some challenges with the official WordPress blogger importer plugin. It’s a short and straight-forward guide, something you can do within a few minutes.

The 5 Fixes for Blogger Importer Plugin Issues

Some of the known issues with the blogger importer plugin are:

  • Success message, without actually importing anything.
  • A blank screen with “Submit” button
  • Warning: Invalid argument supplied for foreach() in /home/blabla/public_html/wp-content/plugins/blogger-importer/blogger-importer.php on line 227
  • Request Timeout error
  • A completely blank screen with neither success nor failure message.

No matter what the challenge is, these five fixes would work in almost every situation. One of them should be able to fix your blogger to WordPress migration problems.

1. Increase Memory and Maximum File Upload Size

This is usually the first place to start your troubleshooting from. For most hosting environment with extremely low memory, meager file upload size, and little execution time. You can ask your host to slightly increase these values for you or do so (yourself) by following after the guidelines below.

Cpanel Method: If your host uses Cpanel, you can increase PHP memory size and WordPress file upload size by using the select PHP version plugin.

To get access to this tool, log in to your Cpanel via yourwebsiteURL.com/cpanel ==> Scroll down to software and locate select PHP version as seen in the screenshot below.

select php version

Click on it and then select Switch to PHP options.

switch to PHP options

Increase the memory, execution time, and file upload sizes. Click on save changes as seen in the screenshot below.

change file upload values

.haccess Method: If you’ll prefer to increase these values faster, the .htaccess file is a great option for this. Simply use your file manager or any other FTP client to locate a file named .htaccess in the same directory as your WordPress files. Sometimes, you’ll need to tick the option to show hidden files to see your .htaccess file.

Edit this file and add these lines before the closing # END WordPress tag. The lines to add is: –

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_input_time 300
php_value max_execution_time 300

change values and save

Save changes and confirm that these values are increased from your WordPress dashboard.

wp-config.php Method: If you prefer this method for increasing your WordPress upload size, simply locate the file named wp-config.php from your WordPress installation directory and add the line below at the end of it.  The line to add is: –

define('WP_MEMORY_LIMIT', '128M');

edit wp-config

Save changes and confirm there are no file size errors no more.

ALSO READ
Anti-spam Plugin Betters Akismet in Blocking Spams for this Reasons

2. Modify XML Parsing in WP Core

In 98.9% of cases, this simple hack by amanmanglik has fixed all issues with migrating blogger contents with the Official Blogger importer plugin.

Here’s how to use this hack to fix “Warning: Invalid argument supplied for foreach() in /home/public_html/wp-content/plugins/blogger-importer/blogger-importer.php on line 227” and similar blogger importer plugin challenges.

edit xml parser

    1. Log in to your cPanel or use an external FTP client to access your WordPress installation directory (files). For managed WordPress hosting, the default file management tool or plugins like WP file manager can be used for this.
    2. Locate a folder name wp-includes and click on it.
    3. Find another folder named SimplePie and click on it.
    4. Locate a PHP file named Parser.php and right-click on it. Select edit from the options and click to edit the file.
    5. Replace everything in it with the code below.
<?php
/**
 * SimplePie
 *
 * A PHP-Based RSS and Atom Feed Framework.
 * Takes the hard work out of managing a complete RSS/Atom solution.
 *
 * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 * 	* Redistributions of source code must retain the above copyright notice, this list of
 * 	  conditions and the following disclaimer.
 *
 * 	* Redistributions in binary form must reproduce the above copyright notice, this list
 * 	  of conditions and the following disclaimer in the documentation and/or other materials
 * 	  provided with the distribution.
 *
 * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
 * 	  to endorse or promote products derived from this software without specific prior
 * 	  written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * @package SimplePie
 * @version 1.3.1
 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
 * @author Ryan Parman
 * @author Geoffrey Sneddon
 * @author Ryan McCue
 * @link http://simplepie.org/ SimplePie
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 */

/**
 * Parses XML into something sane
 *
 *
 * This class can be overloaded with {@see SimplePie::set_parser_class()}
 *
 * @package SimplePie
 * @subpackage Parsing
 */
class SimplePie_Parser
{
	var $error_code;
	var $error_string;
	var $current_line;
	var $current_column;
	var $current_byte;
	var $separator = ' ';
	var $namespace = array('');
	var $element = array('');
	var $xml_base = array('');
	var $xml_base_explicit = array(false);
	var $xml_lang = array('');
	var $data = array();
	var $datas = array(array());
	var $current_xhtml_construct = -1;
	var $encoding;
	protected $registry;

	public function set_registry(SimplePie_Registry $registry)
	{
		$this->registry = $registry;
	}

	public function parse(&$data, $encoding)
	{
		// Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
		if (strtoupper($encoding) === 'US-ASCII')
		{
			$this->encoding = 'UTF-8';
		}
		else
		{
			$this->encoding = $encoding;
		}

		// Strip BOM:
		// UTF-32 Big Endian BOM
		if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
		{
			$data = substr($data, 4);
		}
		// UTF-32 Little Endian BOM
		elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
		{
			$data = substr($data, 4);
		}
		// UTF-16 Big Endian BOM
		elseif (substr($data, 0, 2) === "\xFE\xFF")
		{
			$data = substr($data, 2);
		}
		// UTF-16 Little Endian BOM
		elseif (substr($data, 0, 2) === "\xFF\xFE")
		{
			$data = substr($data, 2);
		}
		// UTF-8 BOM
		elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
		{
			$data = substr($data, 3);
		}

		if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
		{
			$declaration = $this->registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5)));
			if ($declaration->parse())
			{
				$data = substr($data, $pos + 2);
				$data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
			}
			else
			{
				$this->error_string = 'SimplePie bug! Please report this!';
				return false;
			}
		}

		$return = true;

		static $xml_is_sane = null;
		if ($xml_is_sane === null)
		{
			$parser_check = xml_parser_create();
			xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
			xml_parser_free($parser_check);
			$xml_is_sane = isset($values[0]['value']);
		}

		// Create the parser
		if ($xml_is_sane)
		{
			$xml = xml_parser_create_ns($this->encoding, $this->separator);
			xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
			xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
			xml_set_object($xml, $this);
			xml_set_character_data_handler($xml, 'cdata');
			xml_set_element_handler($xml, 'tag_open', 'tag_close');

			// Parse!
			$data_len = strlen($data);
$data_offset = 0;
$chunk_size = 4096000; // sleepy dev's 4MB

while ($data_offset < $data_len )
{
    $data_to_parse = substr($data, $data_offset, $chunk_size);
    $data_offset += $chunk_size;
    
    // Parse!
    if (!xml_parse($xml, $data_to_parse, ($data_offset > $data_len)))
    {
        $this->error_code = xml_get_error_code($xml);
        $this->error_string = xml_error_string($this->error_code);
        $return = false;
    }
}
			$this->current_line = xml_get_current_line_number($xml);
			$this->current_column = xml_get_current_column_number($xml);
			$this->current_byte = xml_get_current_byte_index($xml);
			xml_parser_free($xml);
			return $return;
		}
		else
		{
			libxml_clear_errors();
			$xml = new XMLReader();
			$xml->xml($data);
			while (@$xml->read())
			{
				switch ($xml->nodeType)
				{

					case constant('XMLReader::END_ELEMENT'):
						if ($xml->namespaceURI !== '')
						{
							$tagName = $xml->namespaceURI . $this->separator . $xml->localName;
						}
						else
						{
							$tagName = $xml->localName;
						}
						$this->tag_close(null, $tagName);
						break;
					case constant('XMLReader::ELEMENT'):
						$empty = $xml->isEmptyElement;
						if ($xml->namespaceURI !== '')
						{
							$tagName = $xml->namespaceURI . $this->separator . $xml->localName;
						}
						else
						{
							$tagName = $xml->localName;
						}
						$attributes = array();
						while ($xml->moveToNextAttribute())
						{
							if ($xml->namespaceURI !== '')
							{
								$attrName = $xml->namespaceURI . $this->separator . $xml->localName;
							}
							else
							{
								$attrName = $xml->localName;
							}
							$attributes[$attrName] = $xml->value;
						}
						$this->tag_open(null, $tagName, $attributes);
						if ($empty)
						{
							$this->tag_close(null, $tagName);
						}
						break;
					case constant('XMLReader::TEXT'):

					case constant('XMLReader::CDATA'):
						$this->cdata(null, $xml->value);
						break;
				}
			}
			if ($error = libxml_get_last_error())
			{
				$this->error_code = $error->code;
				$this->error_string = $error->message;
				$this->current_line = $error->line;
				$this->current_column = $error->column;
				return false;
			}
			else
			{
				return true;
			}
		}
	}

	public function get_error_code()
	{
		return $this->error_code;
	}

	public function get_error_string()
	{
		return $this->error_string;
	}

	public function get_current_line()
	{
		return $this->current_line;
	}

	public function get_current_column()
	{
		return $this->current_column;
	}

	public function get_current_byte()
	{
		return $this->current_byte;
	}

	public function get_data()
	{
		return $this->data;
	}

	public function tag_open($parser, $tag, $attributes)
	{
		list($this->namespace[], $this->element[]) = $this->split_ns($tag);

		$attribs = array();
		foreach ($attributes as $name => $value)
		{
			list($attrib_namespace, $attribute) = $this->split_ns($name);
			$attribs[$attrib_namespace][$attribute] = $value;
		}

		if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
		{
			$base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)));
			if ($base !== false)
			{
				$this->xml_base[] = $base;
				$this->xml_base_explicit[] = true;
			}
		}
		else
		{
			$this->xml_base[] = end($this->xml_base);
			$this->xml_base_explicit[] = end($this->xml_base_explicit);
		}

		if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang']))
		{
			$this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang'];
		}
		else
		{
			$this->xml_lang[] = end($this->xml_lang);
		}

		if ($this->current_xhtml_construct >= 0)
		{
			$this->current_xhtml_construct++;
			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
			{
				$this->data['data'] .= '<' . end($this->element);
				if (isset($attribs['']))
				{
					foreach ($attribs[''] as $name => $value)
					{
						$this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"';
					}
				}
				$this->data['data'] .= '>';
			}
		}
		else
		{
			$this->datas[] =& $this->data;
			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
			$this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
			if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')
			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_20 && in_array(end($this->element), array('title')))
			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_090 && in_array(end($this->element), array('title')))
			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_10 && in_array(end($this->element), array('title'))))
			{
				$this->current_xhtml_construct = 0;
			}
		}
	}

	public function cdata($parser, $cdata)
	{
		if ($this->current_xhtml_construct >= 0)
		{
			$this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
		}
		else
		{
			$this->data['data'] .= $cdata;
		}
	}

	public function tag_close($parser, $tag)
	{
		if ($this->current_xhtml_construct >= 0)
		{
			$this->current_xhtml_construct--;
			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
			{
				$this->data['data'] .= '</' . end($this->element) . '>';
			}
		}
		if ($this->current_xhtml_construct === -1)
		{
			$this->data =& $this->datas[count($this->datas) - 1];
			array_pop($this->datas);
		}

		array_pop($this->element);
		array_pop($this->namespace);
		array_pop($this->xml_base);
		array_pop($this->xml_base_explicit);
		array_pop($this->xml_lang);
	}

	public function split_ns($string)
	{
		static $cache = array();
		if (!isset($cache[$string]))
		{
			if ($pos = strpos($string, $this->separator))
			{
				static $separator_length;
				if (!$separator_length)
				{
					$separator_length = strlen($this->separator);
				}
				$namespace = substr($string, 0, $pos);
				$local_name = substr($string, $pos + $separator_length);
				if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
				{
					$namespace = SIMPLEPIE_NAMESPACE_ITUNES;
				}

				// Normalize the Media RSS namespaces
				if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG ||
					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2 ||
					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3 ||
					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4 ||
					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5 )
				{
					$namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
				}
				$cache[$string] = array($namespace, $local_name);
			}
			else
			{
				$cache[$string] = array('', $string);
			}
		}
		return $cache[$string];
	}
}
  1. Save changes and go back to use the blogger importer plugin. Everything should work great at this point.
ALSO READ
Why You Should Use Caching on Your WP Site

3. Use Blogger Importer Extended Plugin

fix blogger importer not working errors

If you aren’t comfortable with option1 and 2 above, using Blogger Importer Extended plugin instead (of the official plugin) should serve perfectly well.

The plugin was initially developed by Yuri Farina but now maintained by Pipdig. It lets you move blogger contents such as labels, images, pages, posts, and authors in just a few minutes.

The latest version of this plugin works flawlessly and even for low-powered hosting services. It is a better alternative to the official blogger importer plugin.

4. Use WP All Import Plugin

import blogger contents to wordpress

Though a bit geeky, WP all import plugin can be used to move blogger content export to WordPress. Just a few clicks and you are all set to move your blogger backup to WordPress.

It is free, comes with a video guide, and lets you import any type of XML file to WordPress. The only downside of WP all import plugin is the few minutes learning curve for first-time users.

It is available at the WordPress repository and can be used on all hosting environment irrespective of shared, managed and/or unmanaged VPS.

5. Use Unconventional Methods

blogger migration guide

If for some reasons you can’t or not willing to use the methods above, this last one will do the magic for you. What is it all about?

Well, you can migrate your blogger contents to WordPress by first migrating it to a Blogger friendly environment. For this tutorial, we are going to use wordpress.com as the bridging CMS. To use wordpress.com for an easy blogger to WordPress migration, complete the few steps below:

    1. Create a free account at wp.com and get a test URL.
    2. Export your blogger contents to a folder you can easily remember
    3. Log in to your WP-admin dashboard and find a button named Import (from the left menu items).
    4. Click on it and select blogger.com from the options displayed.
ALSO READ
Reasons to avoid Nulled/Cracked Premuim WordPress themes

select blogger from the options

  1. Click on Start Import
  2. Upload the blogger contents file you’ve backed up in step2 above.
  3. Wait for the import to complete.
  4. Assign authors and go back to your WP-admin dashboard by typing myfreewpaddress.wordpress.com/wp-admin in the address bar.
  5. Click on Tools ==> Export and save to a folder you can easily remember.
  6. Import the exported content to your main WordPress.org URL. You are all set and done without using the blogger importer plugin.

Prefers a Paid Service?

Well, we do offer a dirt cheap blogger to WordPress migration service. It is normally done professionally and with a zero downtime throughout the migration processes. Permalinks, social signal and SERP ranks are also maintained with proper redirections. Interested persons can get in touch with us via the contact page of this website.

Need more tips on how to resolve blogger importer plugin problems? Tell us about it in the comments section below.

2 COMMENTS

  1. Blogger Importer EXTENDED is my favorite tool for this cause.
    It appears to be more simple for me.

    For the increase memory limit i’ll also want to share a bonus method.
    You can actually increase you WP memory limit by editing or creating a new php.ini file on your cPanal root folder.
    Search out to see if there’s an existing php.ini file and modify it by adding the following code below.

    If there is no existing php.ini file, you can create one and enter the code below.

    1. upload_max_filesize = 64M
    2. post_max_size = 64M
    3. max_execution_time = 300

    The above code will set your limit to 64MB, you can choose any custom size but make sure it does not exceed the allocated size from your host.

    • Thanks for your valuable contribution Dopitech. It’s very much apprecaited

LEAVE A REPLY

Please enter your comment!
Please enter your name here