Support » Fixing WordPress » Fatal error: Cannot redeclare __popular_posts()

  • Guido



    When I change my theme I’m getting this error:

    Fatal error: Cannot redeclare __popular_posts() (previously declared in MY WEBSITE URL \wp-content\themes\twentyeleven\functions.php:791) in MY WEBSITE URL\wp-content\themes\twentyeleven\functions.php on line 1032

    I’ve read some info about how to solve this, but who can tell me WHY this error appears?

    One solution is to remove all lines about popular_posts in file functions.php, but what is the purpose of that code in the first place? Display posts with most responses in the sidebar I guess?

    And when I remove all lines about popular posts from that file, activate theme, put all lines back into that file, the error appears again. This happens with all my themes, so I think somethings wrong in core WordPress files?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Twenty Eleven functions.php has only about 600 lines of code by default;

    you possibly have edited the theme and added this __popular_posts() function or some code containing this function more than once.

    if you are sure that you haven’t edited Twenty Eleven, replace it with a fresh copy, for instance from

    if you have edited the theme, you could paste the full code of functions.php of your edited Twenty Eleven into a and post the link to it here – howto:

    someone might have a look at the code …



    Thank you for your response.

    This error occurs since I’ve changed a specific theme from website into another one. Now I’m getting this error every time I’m changing theme! So the problem is not Twenty Eleven theme (I think).

    This happened before with a template from so I’m afraid something in that code caused a serious problem which stays even when I’m changing theme…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error: Cannot redeclare __popular_posts()’ is closed to new replies.