Fatal error: Call to undefined function wp_register_sidebar_widget() in…

Beware if you update to WordPress 2.5 and are using the very popular K2 theme.

If you are using K2 and you do update to 2.5, you will receive the following error on trying to browse to your WordPress dashboard:

Fatal error: Call to undefined function wp_register_sidebar_widget() in /path-to-blog/wp-admin/includes/dashboard.php on line 31

A bit of research told me that this is because K2 turns off WordPress widgets in favour of its own widget manager and as 2.5 has started to widgetize the Dashboard, you get this error.

To fix the error:
navigate to your K2 folder -> app -> includes
edit the file widgets-removal.php as below

Change the contents of the file from:


Your dashboard should now be browsable once more!

I knew I should have held off on updating longer. I blame Donncha!

64 thoughts on “Fatal error: Call to undefined function wp_register_sidebar_widget() in…”

  1. I upgraded 6 blogs over the weekend from various flavours of V2.x, all with different themes and upwards of 10 plugins. Zero problems so far. I think all the themes I was using were widget-enabled already. Genuinely surprised by lack of hassle.

  2. I have been having trouble with a plugin that is essential for one blog.

    Still, the 2.5 upgrade seems really nice.

  3. Same problem hit me but I’ve been too busy to fix it. I so rarely view the dashboard anyway, although it’s become a lot more useful in 2.5!

  4. There appear to be more problems than just not viewing the dashboard. Deleting spam, updating posts and more all cause failures. Everything works as it should, but you’re taken to an error page.

    I hope the K2 community rises up in assistance!

  5. WoW, that saved me. Getting this error at 3am on April 1st, is not a pleasant joke.

    Thanks for being so unfunny.

  6. I just tried your fix to the same problem that you had. Now im getting a funny php thing at the top… Would you know the reason why this would happen? check the website out and see what i mean by this.

    But thank you for the first workaround.

  7. Jerome – I have no idea what is causing that error on your website.

    Try going back to the file, selecting all, deleting and then copying in exactly the code from above, being sure not to have any extraneous spaces or anything.

    Hope that helps.

  8. Thanks Tom,

    I was checking a bunch of plugins on their compatibility with wp2.5 and suddenly that error kinda spoiled my enthusiasm.

    Glad to see there was an easy (theme related) fix to it.

    Enjoyed your Ecological Server-room session at the Plugg Congress in Brussels btw. And good luck with your Spanish adventure 😉

  9. Jerome,
    I believe it’s a matter of wrong encoding of that file. Please edit this file in more advanced editor (than Notepad for example) so you can set the appropriate encoding. I hope this helps 🙂

  10. For me, I wasn’t using K2 and am still stuck with this error after upgrading… Anymore ideas? I had upgraded 4 different sites with no problems and with this site, I DIDN’T deactivate plugins. However, I’ve checked the list, and none seem to be incompatible…

  11. Jerome:

    The same thing happened to me. As Tom said, there’s an extra space. In my case, I copied/pasted the whole snippet, and the extra space was here:

    < ?php

    Remove the space between < and ?

  12. Thank you all for your responses to my heartache.

    I was looking and trying different things and found a link to another page that had the same fix but with comments in it… Copied simple text and pasted into my php doc and bam. Worked like a charm. Thanks for your help everyone and Tom

  13. Thanks for that fix, and yes, the removal of the space at the beginning is crucial!

  14. I had the same odd PHP script show up top after this fix – issue was the extra space in the first line of the next code. Changed it to


    and it worked. So far at least, got to go try and turn on all my plugins again (yuck).

  15. Thanks so much for this info Tom. A user on the WP forums posted this solution (with credit given to you ;)) when I ran into this problem myself last night. Very frustrating, but this fix worked like a charm. Thanks again.

  16. Tom, Thank you. This was the easiest fix I’ve ever had to do, just search “Fatal error: Call to undefined function: wp_register_sidebar_widget()” and your post is the first result.

    Good job man.

    btw: DON’T JUST COPY/PASTE THE WHOLE THING LIKE I DID, Instead copy/paste from **IF** to (and including) the second to last **}** and replace that.

  17. Thank you for this article, please allow me to quote your article in my blog, this will help my friends fix this issue, I did put link back here at my the end of post at my site.

  18. Thanks- I was panicking when I started to get the error, but the solution turned out to be very simple thanks to you. Appreciate the help.

  19. Someone from the WordPress forums pointed me to this post and I just wanted to say thank you!

    Now if only you could solve all my other problems, hmm….

    but really, thanks….much appreciated!

  20. For me, it was the Now Reading plugin. I had to go to phpMyAdmin and find the activated plugins and delete the Now Reading plugin from there. After doing so, all is back to normal.

  21. hmm i did experience the same thing though right now i just used my backupand reverted my blog back to 2.3.2. im think of just waiting for the K2 compatible with WP2.5 which will be up soon as per dev’s notes. though im gonna try once more using the workaround you’ve given on my next free time.

    however, i do have a question on one scenario i experience. i had another blog which uses k2 also. however the k2 sidebar manager is deactivated as im using wp’s widgets for it. when i upgraded it to 2.5, i didnt encounter a single problem and everything works fine. but im wondering and correct me if im wrong on my idea, IF ever i decide to activate k2’s sidebar manager, would it then cause an error? due to the said conflict on k2 and 2.5? and if it did, will your workaround still work?

    im kinda not willing to try it yet as of the moment as if my hunce is correct and it suddenly causes an error, i dont have ample time to restore my blog presently.

    what do you think? thanks

  22. Thanks a bundle for this fix, Tom.

    Now I’m informing one of the wordpress theme designers (which I’m using) of this error. 🙂


  23. Oh man, you cant guess how much did you help me!!
    Thanks a lot, I will quote your site on mine. And you have a great name 😉 haha like me 😛

    Kindest regards from Argentina

  24. i have the same problem here:http://www.soundscapes.be/blog/wp-admin/
    but i am not running K2.
    it is triplek2 based upon K2.
    I don’t have the file mentioned above.
    I do have app/includes/sbm.php
    i tried to replace this with the recent k2, but that didn’t work out well.
    anyone an idea what I can do to fix the dashboard?
    I don’t feel like making a new theme (it’s an modified theme which looks great in my opinion).

  25. Also, the Sidebar Module Reloaded plugin produces this same error message and disables the Dashboard. Any ideas on how to get around this? I much prefer the SBM plugin to the WP built-in widgets. Much easier and nicer to navigate.

  26. Hi, I’m wondering if you could tell me how to fix this error I’m receiving Fatal error: Call to undefined function require_wp_db() in /home/nabw9364/public_html/wp-settings.php on line 250

    originally I had a couple other errors but knocked it down to this one since my widget.php file was in the wrong dir.

    I started receiving errors when I accidently put a tracking code into my widgets instead of my sidebar.php. I’ve been spending hours trying to fix it and now I’m at a loss with this one. Any suggestions would be appreciated.

Comments are closed.