How to fix WordPress fatal error cannot redeclare get_cli_args()

How to fix  WordPress fatal error cannot redeclare get_cli_args()

Problem: WordPress Fatal error: Cannot redeclare get_cli_args() (previously declared in …class-wp-importer.php)

If you get the error "Fatal error: Cannot redeclare get_cli_args() (previously declared in ...class-wp-importer.php)", you most likely use two or more Importer/Exporter plugins at once.

For example, this error is caused when you have One Click Demo Import and Theme Demo Import plugins activate simultaneously on your WordPress website (at least at the moment of writing).

Solution

Remove the one you don’t need. If you can’t access your WordPress dashboard, use FTP/SFTP to delete the import/export plugin(s) folder.

Developers

Include wp-admin\includes\class-wp-importer.php using include_once or require_once to prevent the error of get_cli_args() function declared twice.

 
demo   Mediumish - our most loved WordPress theme
Mediumish Theme