Fatal error: Cannot redeclare
-
I have a theme file that gets called via ajax and acts as a json service for other pages on the site. When I installed this plugin, the ajax file went all 500 and gave me the message:
Fatal error: Cannot redeclare <function name> (previously declared in (<…>functions.php:10) in <…>functions.php on line 30
It turns out, my theme’s functions.php was being included twice – once from WordPress and a second time from the plugin.
The problem is in twitter-posts-to-blog.php on the first two lines of code. Changing
require_once 'libs/twitteroauth/twitteroauth.php'; require_once 'functions.php';to
$dir = plugin_dir_path( __FILE__ ); require_once($dir.'libs/twitteroauth/twitteroauth.php'); require_once($dir.'functions.php');resolves the issue.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Fatal error: Cannot redeclare’ is closed to new replies.