• thedanielthorne

    (@thedanielthorne)


    I’ve just finished designing a website and the last thing I did before completing it was update to the new wordpress, instantly I got error code:

    Fatal error: Cannot redeclare get_avatar_url() (previously declared in /home/wstaging/subdomains/tax/public_html/wp-includes/link-template.php:3414) in /home/wstaging/subdomains/tax/public_html/wp-content/themes/zeyn/lib/custom_functions.php on line 623

    What could possible of happened and how do I fix it, i can’t access the wp-admin page now. Do I need to go into the ftp or service provider to fix it?

    Thanks

Viewing 15 replies - 1 through 15 (of 17 total)
  • WPyogi

    (@wpyogi)

    Yes, on the server rename your theme here:

    wp-content
       themes
           zeyn.HOLD

    See if that lets you login again.

    derbtek

    (@derbtek)

    I had the same problem right after updating just now, and added the “.HOLD” to the theme name, and now I again have access to the admin area.

    My question is…. WHY? Why would adding .HOLD to the theme name fix this error?

    And more importantly…. is this something we have to do on all sites before updating them? Adding that .HOLD to every theme name?

    Is this a permanent fix, or only temporary?

    This is very odd, to say the least.

    jacksmithy

    (@jacksmithy)

    I had the same issue after updating to 4.2 any help will be much appreciated.

    files are still accessible via ftp but site is completely down and this is the error: public_html/wp-includes/link-template.php:3414

    WPyogi

    (@wpyogi)

    WPyogi

    (@wpyogi)

    @derbtek – it deactivates that theme – which has a problem. No that is not standard – in this case, the error showed a theme error.

    If you look at the error log it will tell you which line contains the error and which file. An easy way to put a temporary fix on this without removing the theme would be to edit that file. Comment out the section that is causing the error. In the case of the OP it would be editing the file:

    /home/wstaging/subdomains/tax/public_html/wp-content/themes/zeyn/lib/custom_functions.php

    On line 623 you should see a statement that is used for avatars. Comment out the entire thing by placing /* in front of the statement and */ immediately following it. This will exclude it from being processed. Your website should load just fine after making this change and the code will still be there, just excluded from processing.

    djstangl

    (@djstangl)

    Thank you Todd, you are awesome!

    @djstangl – no problem.

    I should have added that this function was built into WordPress in 4.2, but was previously something that the theme author had to bake in. In 4.2 the exact same statement that you commented out is included in wp-includes/link-template.php.

    Therefore, it is completely safe to remove it because it’s a duplicate code conflict. Commenting it out is just a safer way to explain to people. I hate telling people to remove code because they may remove the wrong thing.

    solseeking

    (@solseeking)

    I’ve tried placing /* and */ around the statement with no luck 🙁 I also updated my WP theme through FTP with no luck…help!

    solseeking

    (@solseeking)

    Just updated it and it worked – thanks!!

    ptums

    (@ptums)

    I commented out
    function get_avatar_url($get_avatar){
    preg_match(“/src='(.*?)’/i”, $get_avatar, $matches);
    return $matches[1];
    }

    after I updated to WordPress 4.2 my site is working again, but any page that features an image of an attorney generated by this avater function no longer exists

    Ptums,

    That is completely expected for some themes.

    Ask your theme author to resolve this. It’s not a blanket fix for everyone.

    Todd

    Kiarma

    (@kiarma)

    I tried it and it works. But once inside, you have to install the new theme immediately.

    I screwed by clicking on the old theme and it has occurred the problem that I have not solved with more function .HOLD.
    If you have the possibility to join the ‘FTP see where the error is and which row and replace the line with the updated template or replace the file directly (in my case was filter.php).

    Another option is to check if function exist.

    OLD CODE:

    function get_avatar_url( $get_avatar ) {
    			preg_match("/src='(.*?)'/i", $get_avatar, $matches);
    			return $matches[1];
    		}

    NEW CODE:

    if(!function_exists('get_avatar_url')){
    		function get_avatar_url( $get_avatar ) {
    			preg_match("/src='(.*?)'/i", $get_avatar, $matches);
    			return $matches[1];
    		}
    	}
Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘updated wordpress and got error: Cannot redeclare get_avatar_url’ is closed to new replies.