Back to Community

Fixing WordPress Importer Strict Standards Errors and Warnings

25 threads Sep 7, 2025 PluginWordpress importer

Content

Many WordPress developers and site administrators encounter a common set of warnings when using the WordPress Importer plugin with WP_DEBUG enabled. These warnings, while not typically breaking the core import functionality, can clutter the admin interface and sometimes lead to more severe "headers already sent" errors. This guide explains the cause of these errors and provides practical solutions.

Common Error Messages

Users consistently report two primary "Strict Standards" warnings appearing on the Tools → Import screen (wp-admin/import.php):

  1. Redefining already defined constructor for class WXR_Parser_Regex in parsers.php on line 408.
  2. Declaration of WP_Import::bump_request_timeout() should be compatible with WP_Importer::bump_request_timeout($val) in wordpress-importer.php on line 38.

In some cases, these warnings can also trigger secondary errors like "Warning: Cannot modify header information - headers already sent," which can prevent the admin page from rendering correctly.

Why These Warnings Occur

These are not bugs that prevent import but rather code standards warnings triggered by specific PHP configurations:

  • Outdated Plugin Code: The warnings stem from coding practices that were acceptable in older versions of PHP but now violate stricter standards enforced in PHP 5.4 and later.
  • WP_DEBUG is Enabled: These messages are only visible when WP_DEBUG is set to true in your wp-config.php file, which is common on development and staging sites.
  • PHP Version: The warnings are more prominent on servers running PHP 5.4, 5.5, 5.6, and 7.x due to their stricter error reporting.

How to Resolve the Warnings

Solution 1: Update the Plugin (Recommended)

The ideal solution is to ensure you are using the latest version of the WordPress Importer plugin. The 'WordPress Importer' team has addressed these compatibility issues in more recent updates. Check your Plugins page in WordPress admin for an available update.

Solution 2: Apply a Temporary Code Patch (For Developers)

If an update is not available or does not resolve the issue, you can manually patch the plugin files. Warning: Editing plugin files directly is not recommended as changes will be lost when the plugin updates. This is a temporary development fix.

Fix for the first error in parsers.php:
Navigate to the wp-content/plugins/wordpress-importer/parsers.php file. Around line 404, you will find a PHP4-style constructor. Comment it out or remove it:

// function WXR_Parser_Regex() {
//     $this->__construct();
// }

Fix for the second error in wordpress-importer.php:
Navigate to the wp-content/plugins/wordpress-importer/wordpress-importer.php file.

1. Ensure the WP_Import::bump_request_timeout method declaration includes the required $val parameter:

function bump_request_timeout($val) {
    ... // existing code
}

2. Also, check for and remove any deprecated PHP4-style constructor for the WP_Import class around line 66:

// function WP_Import() { /* nothing */ }

Solution 3: Disable WP_DEBUG on Production Sites

On a live production site, WP_DEBUG should be disabled for security and performance reasons. Setting define('WP_DEBUG', false); in your wp-config.php file will hide these warnings. They are intended for development environments only.

Conclusion

The Strict Standards warnings from the WordPress Importer are a known issue related to older code styles and modern PHP versions. While the import process often works correctly despite them, applying the recommended updates or the temporary code fixes outlined above will clean up your admin interface and ensure better compatibility with current PHP standards. For the most permanent and secure solution, always check for and install the latest version of the plugin.

Related Support Threads Support