Fix ->Wordpres plugin could not be activated fatal error cannot redeclare!

Posted: October 30, 2010 in Wordpress

I have seen this error thrown up many many times while activating a wordpress plugin and the

Plugin could not be activated because it triggered a fatal error.

Fatal error: Cannot redeclare similar_posts() (previously declared in /home/pbu/public_html/blog/wp-content/plugins/xxxx/xxxx:45) in /home/pbu/public_html/blog/wp-content/plugins/x/xxxx.php on line 46

The main reason why the plugin could not be activated is because there must be either a plugin clash using same function or a wordpress theme calling the plugin function using the same name ie. double declaration.

Placing the plugin code in your wordpress theme file like this is the root cause for fatal errors in blogs and plugin activation.

If the plugin gets deactivated or not present, it would simply crash your blog with fatal error.

The safe way of placing plugin code in your theme files is first to check whether the function exists, if so call it.

if (function_exists(’similar_posts’))

In the above method, even if the plugin is not installed, it wouldnt crash your blog!

To fix:

1. Deactivate the plugin first.
2. Look in your wordpress theme files (single.php, archive.php, index.php) including widgets for a function call with same name (usually redeclaration), just remove or comment it out.
3. Now activate the plugin and see if it works.

  1. fioricet tabfioricet detox
    A residence region shows quality of the economic financial waste left under the downtown gold bank.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s