Hi, WordPress always been good platform for making blogs and sites because of it is having so many plugins and free themes and also it is very easy to upgrade all plugins and wordpress new version without any hassel, upgrade plugin and wordpress just take one or two clicks. But sometimes while upgrading wordpress to old version to its latest version it creates lots of errors and causes stop website working, So whenever you are upgrading wordpress or plugins just take backup of all files and DB and then upgrade. So today in this article I am going to tell you solution of one error which came when we upgrade to wordpress from older version to latest.
Some days ago I upgraded one client website to latest version of wordpress which is Wodpress 3.5.1 from WordPress 3.4 and when I started WordPress upgrade by wordpress upgrade process this time it really wasn’t smooth. It failed and then when I reload admin gives me error like this :
Fatal error: Call to a member function register_handler() on a non-object in /home/foldernameofsite/public_html/wp-includes/media.php on line 953
In my case it was giving error in line number 953 but in your case it would be any other line.When I saw this error and then checked site was down and showing this error I was really tensed because site was live but on other hand i was little bit happy that I took backup of site and db before doing this, So if this problem will not solve I will just restore all things.
So now time to solve this error. So when I saw this error first thing I did is directly search this error into Google without checking media and I found lots of wordpress.org support forums with this issue and there are lots of solutions too, some were working for people some weren’t, So I tried to solve this error by trying all solutions but didnt work any solution, So finally tried to check out line number 953 in media.php file in wp-includes. There was a function with 2 lines in it on line number 953, So I thought to make that function in comment, but it lead me to another horrible error, So finally I uncomment it and then try searching again and at last after searching and reading lots of forums, posts I finally got solution of issue which worked for me.
Open wp-setting.php in your site root folder and search below code :
require( ABSPATH . WPINC . '/update.php' ); require( ABSPATH . WPINC . '/canonical.php' ); require( ABSPATH . WPINC . '/shortcodes.php' ); require( ABSPATH . WPINC . '/media.php' ); require( ABSPATH . WPINC . '/http.php' ); require( ABSPATH . WPINC . '/class-http.php' );
Now replace it with below code(in below code you can see I added only one line) :
require( ABSPATH . WPINC . '/update.php' ); require( ABSPATH . WPINC . '/canonical.php' ); require( ABSPATH . WPINC . '/shortcodes.php' ); require( ABSPATH . WPINC . '/class-wp-embed.php' ); require( ABSPATH . WPINC . '/media.php' ); require( ABSPATH . WPINC . '/http.php' ); require( ABSPATH . WPINC . '/class-http.php' );
You can see I added/included class-wp-embed.php. When we included class-wp-embed.php error gone and all things worked properly. When we include this file in wp-setting.php it included all functions and class which causes error while upgrading wordpress. So this is first thing you need to check when you get this error.
If your problem is not solved by this solution then you can do following things one by one :
First if you can access admin :
1. If you can access admin then disable all plugins and change your theme to default twentyeleven or twentyten.
2. Download latest wordpress version and then upload latest wp-admin and wp-includes to your site.
Second if you cant access admin and not able to deactivate plugin or current theme to default theme then do this one by one :
1. Rename ‘plugins’ folder and then rename your current theme folder to something like adding ‘-old’ to last of its name.
2. Upload latest wordpress wp-admin and wp-included to your site root and replace with old one.
So these are different ways to solve this type of errors. I hope this will help someone. Let me know if you have any other method to solve it, I will add it here in article under your name.
I am wordpress Developer, Hire WordPress Developer India and Hire WordPress Programmer. If you have any projects related to wordpress or PHP you can contact me.
I had this exact same error. Your solution worked! I don’t know how that line of code got removed, but that solved my entire problem. My webhost had deleted almost the entire contents of my public html folder (where my wordpress install was) and when they restored it with their backup (yeah, I know, should have had one of my own!) it kept throwing a 500 Error. The db was there, all my content, all the wordpress files…no joke, it was ALL there, but my site wouldn’t load!
Added that missing line of code, and…BOOM! 100% functionality!!! Thank you!
Thanks a lot, it’s help me so much.
Огромное спасибо Вам!
Perfect solution. Saved lot of time. Thanks
I got same error today when automatic WordPress updated failed.
My site was live and working,but my login page was blank.
I checked error log and found error you mentioned. Mine was just on other line.
I solved it by downloading media.php (as backup).
Then I deleted code on line that was causing error. I was then able to login to my site (no more blank page problem).
I updated WordPress and upload back original media.php file. All worked fine.