visiting /wp-admin alters functions.php (6 posts)

  1. Matthew W
    Posted 5 years ago #

    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:

    function _verifyactivate_widget()

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

  2. vtxyzzy
    Posted 5 years ago #

    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).

  3. Matthew W
    Posted 5 years ago #

    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.

  4. vtxyzzy
    Posted 5 years ago #

    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.

  5. Matthew W
    Posted 5 years ago #

    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?

  6. vtxyzzy
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic