Title: Fatal error: Cannot redeclare
Last modified: August 21, 2016

---

# Fatal error: Cannot redeclare

 *  [Daniel](https://wordpress.org/support/users/creon/)
 * (@creon)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-14/)
 * 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.
 * [http://wordpress.org/plugins/twitter-posts-to-blog/](http://wordpress.org/plugins/twitter-posts-to-blog/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [alemarengo84](https://wordpress.org/support/users/alemarengo84/)
 * (@alemarengo84)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-14/#post-4502600)
 * Which version of WP do you run?
 *  Thread Starter [Daniel](https://wordpress.org/support/users/creon/)
 * (@creon)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-14/#post-4502602)
 * WordPress 3.8 (currently the latest) & Plugin 1.11.20 (currently the latest).

Viewing 2 replies - 1 through 2 (of 2 total)

 The topic ‘Fatal error: Cannot redeclare’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/twitter-posts-to-blog_dadada.svg)
 * [Twitter posts to Blog](https://wordpress.org/plugins/twitter-posts-to-blog/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/twitter-posts-to-blog/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/twitter-posts-to-blog/)
 * [Active Topics](https://wordpress.org/support/plugin/twitter-posts-to-blog/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/twitter-posts-to-blog/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/twitter-posts-to-blog/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Daniel](https://wordpress.org/support/users/creon/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-14/#post-4502602)
 * Status: not resolved