2

I'm getting the following error:

Fatal error: Cannot redeclare get_cli_args() (previously declared in C:\xampp\htdocs\wordpress\wp-admin\includes\class-wp-importer.php:276) in C:\xampp\htdocs\wordpress\wp-admin\includes\class-wp-importer.php on line 276

function get_cli_args( $param, $required = false ) {
    $args = $_SERVER['argv'];
    if ( ! is_array( $args ) ) {
        $args = array();
    }
    // ...
}

How do I fix it?

1
  • When this error occurred, what were you trying to do? Please add more details.
    – Fayaz
    Commented Feb 11, 2023 at 23:45

1 Answer 1

3

Are you somehow including wp-admin\includes\class-wp-importer.php using include or require? That may cause the error of get_cli_args() function declared twice.

If that is the case, then you better use include_once or require_once.

Also, perhaps you should test your installation by disabling all the plugins and any custom theme. Then activate the theme and test WordPress. Then activate one plugin at a time and test each time to see if the error appears. This will show if this error is caused by any plugin or theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.