WordPress.org

Ready to get started?Download WordPress

Forums

Twitter posts to Blog
Fatal error: Cannot redeclare (3 posts)

  1. Daniel
    Member
    Posted 7 months ago #

    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/

  2. alemarengo84
    Member
    Posted 7 months ago #

    Which version of WP do you run?

  3. Daniel
    Member
    Posted 7 months ago #

    WordPress 3.8 (currently the latest) & Plugin 1.11.20 (currently the latest).

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.