WordPress.org

Support

Support » How-To and Troubleshooting » visiting /wp-admin alters functions.php

visiting /wp-admin alters functions.php

  • My theme is a simple child theme of twentyten. Its functions.php file is altered when I visit /wp-admin. PHP functions are added from the parent theme.

    I’m running wp 3.1.3 locally on windows xampp. I get this error:

    Fatal error: Cannot redeclare _verifyactivate_widget() (previously declared in Z:\[ path ]\wp-content\themes\[ child theme ]\functions.php:326) in Z:\[ path ]\wp-content\themes\twentyten\functions.php on line 531

    Why are functions from twentyten getting put into the child theme?

    It begins:

    <?php
    function _verifyactivate_widget()

    Full paste of added code: http://pastebin.com/g54Rw5pN

Viewing 5 replies - 1 through 5 (of 5 total)
  • The parent theme’s functions are always loaded in a child theme. If the child functions.php loads a function that is not declared properly in the parent functions.php, you will get the ‘Cannot redeclare … ‘ error.

    All functions in the parent need to be wrapped in a test for their existence (or not declared in the child theme).

    I understand that — but these functions are actually being written to the file itself — the template file is altered by WordPress.

    After that, the conflict emerges, because then both the child and parent contain the same function.

    I can delete the appended code, but the rewrite repeats. I’ve never seen anything like it.

    Sorry, I misunderstood.

    I have never seen that before. I doubt that the child file is altered by WordPress. It almost certainly is due to a plugin, or maybe you have been hacked.

    I have deactivated all plugins. The problem remains.

    If I empty functions.php — the file is still altered.

    If I remove functions.php — the problem vanishes.

    The last thing I did was install a couple of themes and activated autofocus plus. Note — I had done this on a different site of this multisite installation. I removed all those themes. Is it possible that one of those themes altered core files or the database?

    How can I sniff out the problem before reinstalling wordpress?

    I did a quick scan of the twentyten and wp-includes folders in a newly installed site and did not find the string ‘getprepare’ in any .php file.

    I suspect that either you have been hacked, or that a previously installed plugin has left behind some junk.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘visiting /wp-admin alters functions.php’ is closed to new replies.
Skip to toolbar