• Just upgraded to 4.6 from 4.5.3 and my entire site has crashed.

    How can I fix this?

    Error message is Fatal error: Cannot redeclare the_post_thumbnail_caption() (previously declared in /home/noise15/public_html/wp/wp-includes/post-thumbnail-template.php:244) in /home/noise15/public_html/wp/wp-content/themes/thesis_18/custom/custom_functions.php on line 617

Viewing 15 replies - 1 through 15 (of 17 total)
  • Looks like your theme uses a function name that was added in 4.6. Which is poor form, since if it was prefixed this wouldn’t have happened.

    Going by the folder name, I’m assuming you’re using this theme: https://diythemes.com/thesis/ ?

    If so, as it is a commercial product, you’ll need to contact the developer’s support channels.
    https://codex.www.ads-software.com/Forum_Welcome#Commercial_Products

    You’ll likely need to perform a manual update of the theme.

    Thread Starter PaulCashmere

    (@paulcashmere)

    yes Jacob It is Thesis. Would there be a sql file from the backup I can re-add to fix the problem? We have the sql files backed up and current

    Hi, it seems that the core now has the same function named exactly the same as your theme.

    PHP function:
    the_post_thumbnail_caption()

    As I have absolutely no knowledge of that theme and as it seems to be a commercial theme, you should contact developers if they didn’t already catch the issue themselves.

    Or, you can fix the problem by yourself renaming the theme’s function name to something else (for example: into thesis_the_post_thumbnail_caption()) and all instances that use/call it.

    Alternatively, you can compare both functions and see if they match in code. If they are 100% the same, you can safely delete the function from your theme’s custom_functions.php file.

    Thread Starter PaulCashmere

    (@paulcashmere)

    thanks Darko, when I go to Cpanel and drill down to the file containing the code I find two instances of that the_post_thumbnial_caption() in the code like this below. Should I simple change the two references in this file as you suggest?

    //function to use featured image on post
    add_action(‘thesis_hook_before_headline’,’nsefeatimg’);
    function the_post_thumbnail_caption() {
    global $post;

    $thumbnail_id = get_post_thumbnail_id($post->ID);
    $thumbnail_image = get_posts(array(‘p’ => $thumbnail_id, ‘post_type’ => ‘attachment’));

    if ($thumbnail_image && isset($thumbnail_image[0])) {
    echo ‘<span>’.$thumbnail_image[0]->post_excerpt.'</span>’;
    }
    }

    function nsefeatimg(){
    if (!( ‘vinterviews’ == get_post_type() || ‘vsessions’ == get_post_type() || is_page())){
    echo ‘<div class=”nsefeatimg left”>’;
    the_post_thumbnail( ‘medium’);
    echo ‘<p class=”wp-caption-text”>’;
    the_post_thumbnail_caption();
    echo ‘</p></div>’;

    It might be sensible not to rush updating to WP 4.6 at the moment.

    I’ve updated it on one of our many site and thought it had crashed. Turns out it worked OK, but appeared to get stuck.
    I notice that this version of WP comes with native fonts – as a graphic designer of over 25 years, I can say that fonts can cause massive problems….

    The solution above by Darko A7, looks like a big ask tho.
    I don’t fancy doing that on 40 websites….

    You’d need to be sure that these are the only two instances of that function. It could be being used in other files (templates for example). But if you rename them all the same thing, the site should start working again.

    However, as you’re modifying theme files, the changes could be reverted when your theme is updated. So make sure your theme is compatible with 4.6 before performing any update.

    @bloohair If you’re not using the same theme as Paul, you won’t need to do this.

    Thread Starter PaulCashmere

    (@paulcashmere)

    Hi Jacob should the only two instances of that name the_post_thumbnail_caption() be in this file or are there are areas of the site I need to search as well?

    I’m not sure as I’m unfamiliar with your theme, but it’s certainly possible. You would need to make sure no files inside /wp-content/themes/thesis_18/ use the function.

    If you use an editor like Atom, or Sublime Text, you could download a copy of your theme and use the Search functionality of the editor to find all uses of the function.

    Thread Starter PaulCashmere

    (@paulcashmere)

    Darko and Jacob you are both absolute GENIUS. That worked and we are back online. Thankyou so much. I really appreciate your help

    Sorry for not timely replying, but glad you solved it!

    For future reference, the easiest way to find occurrence(s) of something across multiple files is to use some code editor tool, or even Notepad++, then use Find > Find in files tool and enter the term you wish to search for, as well as directory location. Then, you can get the list of all files the term occurs/is used in. Of course, keep in mind that the_post_thumbnail_caption( and the_post_thumbnail_caption ( are 2 different terms, but it is the same from PHP code perspective (e.g. they are the same thing in PHP, but not in text terms due the space between name and parenthesis). So, you need to be clever and search only for the_post_thumbnail_caption because () can contain arguments, spaces etc.

    Thread Starter PaulCashmere

    (@paulcashmere)

    thanks again Darko for you generous assistance

    Thanks for the help in this for fixing my problem also! Great community support.

    Jason King

    (@jasoncharlesstuartking)

    I’d used the exact same function name in one of the themes I coded, and it crashed a website.

    Lesson learned: always prefix your own functions with a word no-one else will ever coincidentally think of using.

    My site has just crashed also. The error message I’m getting is
    Parse error: syntax error, unexpected T_STRING in /home/content/22/6190322/html/wp-content/plugins/wptouch/core/class-cache-smash.php on line 104

    I’ve never had this trouble before. Yesterday I was having trouble uploading documents to the website development “library” of media/documents. Is this a general problem with WordPress right now or something specific to our site? Thanks for any assistance.
    Lloyd

    I ran into this same issue on upgrade to 4.6, same variable name (maybe from the same code snippet?), same conflict. Super helpful thread! Thank you.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘4.6 has crashed my site’ is closed to new replies.