Support » Fixing WordPress » Fatal Error has Locked Me Out!

  • I altered my child theme by copying and pasting the parent theme functions.php page to my new functions.php page and this is what happened.

    Fatal error: Cannot redeclare twentytwelve_setup() (previously declared in /home/clhurley/webapps/wp/wp-content/themes/2012child/functions.php:52) in /home/clhurley/webapps/wp/wp-content/themes/twentytwelve-1/functions.php on line 77

    I am completely locked out of WordPress and Webfaction, my host, and have no idea how to fix this..

    or what happened?

    This happened last night, as well, but I believe Webfaction fixed it. Does anyone know how to fix this??

    My blog is completely inaccessible.. even to me! Help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The issue is because you copied a file, including all of it’s functions. So now, PHP is finding two functions with the same name, and it is causing an error.

    To fix, you need to connect to your site via FTP (your hosts can help you with this, if you have no FTP access already) and remove the copied file, meaning there is only one instance of each function again.

    To make a function pluggable (so that it is only included if it does not already exist) you need to wrap the function as follows –

    if(!function_exists('my_function')) :
        function my_function(){
            // Blah, blah, blah...


    I’ve just re-read your post and saw that it is about a Child Theme. To ensure that your Child Theme references the correct files, make sure that you include the template name style.css file for the Child Theme

    'Template: twentytwelve'

    I believe the problem lies here:
    Under the heading “Using functions.php

    From the page:

    Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

    And most importantly:

    Do not copy the full content of functions.php of the parent theme into functions.php in the child theme.

    How might this work if you would like to stop the child theme from displaying certain admin options like picking a header image? I have created a child theme using twentytwelve as a parent and would like to turn off
    require( get_template_directory() . '/inc/custom-header.php' );

    When I comment out this line in the parent theme’s functions.php the header image picker no longer displays – perfect. How might I achieve this in the child theme?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal Error has Locked Me Out!’ is closed to new replies.