• Hi,

    So I was adding the following code to my functions.php file so that I could display a list of daily tasks in the Dashboard area, this has worked perfectly on 3 other installs and initially appeared to be working fine also.

    add_shortcode('clarity','clarity_shortcode');
    
    function my_admin_notice() {
        ?>
        <div class="updated">
            <p><?php _e( 'Daily Tasks: <strong>Item1</strong>.', 'my-text-domain' ); ?></p>
        </div>
        <?php
    }
    add_action( 'admin_notices', 'my_admin_notice' );

    Shortly after adding the code and clicking update I went back to Appearance > Editor to make further changes to the text that was being displayed, I clicked ‘Update’ and when the site refreshed I received a ‘500 Internal Server Error’.

    So naturally I went to the htaccess file to check for issues, but there are non here.

    So I attempted to replace the functions.php file with a new, unedited one from the themes installation folder and now I’m recieveing this error:

    “Fatal error: Call to undefined function get_template_directory() in /…/folder/members/wp-includes/functions.php on line 15”

    I’ve moved:

    require( ABSPATH . WPINC . ‘/plugin.php’ );

    …above…

    require( ABSPATH . WPINC . ‘/functions.php’ );

    … in wp-settings.php but this hasn’t fixed the issue as suggested by some forum posts.

    Can anyone help me fix this issue?

    Thanks,

    Best Regards,
    AFX

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi

    get_template_directory() functions does not exist in functions.php

    Instead, get_temp_dir() is there, at line 1701.

    Maybe the file you tried to default to was old and not updated. Try changing get_template_directory() in functions.php from wp-includes to get_temp_dir() and see if it works

    Thread Starter Jack

    (@argentumfx)

    Hi GrandMa90,

    I’m now receiving this error message instead:

    Parse error: syntax error, unexpected ‘)’ in /…/folder/members/wp-includes/functions.php on line 15

    Hold on a minute, I’ll check for errors locally

    Ok, try pasting this in functions.php

    add_filter( ‘ot_show_pages’, ‘__return_false’ );
    add_filter( ‘ot_show_new_layout’, ‘__return_false’ );
    add_filter( ‘ot_theme_mode’, ‘__return_true’ );
    load_template( get_template_directory() . ‘/option-tree/ot-loader.php’ );

    replacing what was once there before. It’s around line 15.

    Thread Starter Jack

    (@argentumfx)

    Unfortunately still no luck:

    Fatal error: Call to undefined function load_template() in /home/argentumfxco/members/wp-includes/functions.php on line 19

    Oh, man, you really did a number on him! Is there any way you can restore from a backup? Right now I think this can be the only solution…

    Thread Starter Jack

    (@argentumfx)

    I’ve worked out the solution for anyone else who runs into this issue after editing/adding code to functions.php.

    Obviously when a ‘500 Internal Server Error’ appears you should always:
    – Check your .htaccess file
    – Re-upload core files via FTP (do NOT upload wp-config.php or wp-content folder)
    – Search your functions.php file using a text editor (such as TextWrangler on Mac) for any code you have added

    If you haven’t fixed the issue by this point you’re in the same boat as I was:

    Instead of looking at the functions.php file in the wp-includes folder, navigate to:

    …/wp-content/themes/your_active_theme/functions.php

    and check for any flaws in this file.

    If you are using a child theme make sure you check the child theme folder first and check to see if your site is running before looking in the parent theme folder.

    I hope this helps!

    AFX

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Call to undefined function after functions.php edit.’ is closed to new replies.