Fatal error: Cannot declare class Algolia_Command

Hi – I am trying to setup the Wordpress API according to these instructions.

But I get to the wp algolia reindex_post part and I am getting an error

wpe-user@kozzi2020.ssh.wpengine.net : /sites/kozzi2020/wp-content/plugins/algolia-custom-integration/api-client $ wp algolia reindex_post

Fatal error: Cannot declare class Algolia_Command, because the name is already in use in /sites/kozzi2020/wp-content/plugins/algolia-custom-integration/wp-cli.php on line 13

Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website.

Here are my files

Can someone please tell me what I am missing as I have be over this now for hours.

Thanks
Dan Kosmayer

Hi @social, In the wp-cli.php file, I see on line 7 where you have an empty class for Algolia_Command. On line 13, you have also defined a class Algolia_Command. The error is occurring because you have two classes defined with the same name, ‘Algolia_Command’. You can delete lines 7-9 to remove the error.

Hi Cindy

Yes that did the trick – thank you the quick response.

I will continue to setup process and let you know if any other questions arise.

Dan Kosmayer

1 Like