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:

to

Your dashboard should now be browsable once more!

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

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

  1. Conor O'Neill avatar

    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. Milan avatar

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

    Still, the 2.5 upgrade seems really nice.

  3. Donncha O Caoimh avatar

    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. Todd avatar

    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. Mark avatar

    Brilliant – worked for me first time. Thanks for sharing!

  6. kobak avatar

    The recent svn version fixes the problem.

  7. […] you try to display the admin dashboard. I googled a bit and found a post which kind of fixed the problem but not quite. The altered code appeared at the top of every page. […]

  8. Tibor avatar

    Thank you so much for finally showing up in Google 😉

  9. John A avatar
    John A

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

    Thanks for being so unfunny.

  10. Jerome Pearce avatar

    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.

  11. Tom Raftery avatar

    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.

  12. […] Si te aparece Fatal error: Call to undefined function: wp_register_sidebar_widget() in E:INetwwwrootunpuntonaranja.comrootwp-adminincludesdashboard.php on line 31 al entrar al tablero de WordPress, la solución, aquí. Una explicación mejor, aquí. […]

  13. Jaroslaw Dobrzanski avatar

    Tom, thanks for the solution!

  14. […] I’ve found a very simple solution on Tom Raftery’s Social Media Blog. Tom, thanks for sharing with […]

  15. cubus avatar

    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 😉

  16. Jaroslaw Dobrzanski avatar

    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 🙂

  17. Wags avatar

    Thanks a lot, Tom. A simple fix — the best kind.

  18. Jeff avatar

    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…

  19. Greg avatar
    Greg

    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 ?

  20. Jerome Pearce avatar

    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

  21. […] Fatal error: Call to undefined function wp_register_sidebar_widget() in… 之後在Tom Raftery’s Social Media這裡看到解決的方式 按照上面的修改之後 在main […]

  22. […] pesquisar sobre o problema no Google, encontrei a solução no blog do Tom Raftery: o tema K2 desativa o sistema de widgets do WordPress para que possa usar o […]

  23. Peter Reid avatar
    Peter Reid

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

  24. Kevin avatar

    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

    <?php

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

  25. […] Het probleem is, dat wanneer je de sidebar manager inschakeld, die op zijn beurt de WordPress widgets (waar het nieuwe dashboard nu ook gebruik van maakt) uitschakelt. Gelukkig vond ik het weblog van Tom Rafferty, die het probleem heeft getackled. […]

  26. Dave avatar

    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.

  27. […] d’avoir, à savoir l’accès impossible au tableau de bord. Mais grâce à ce gentil Tom Rafteryit, et bien, vous pourrez à nouveau acceder à votre […]

  28. hemineko avatar

    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.

  29. […] Thank Tom for this article. Thưởng thức và chia sẻ: Những biểu tượng này liên kết đến các Websites, nÆ¡i các Ä‘á»™c giả có thể chia sẻ và khám phá các Websites má»›i. […]

  30. Linharex avatar

    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.

  31. Tom Raftery avatar

    Linharex,

    thanks for stopping by and commenting. Please feel free to quote this article in your blog.

    Cheers,

    Tom

  32. Shaun avatar

    Thanks for the fix, I was starting to panic! 🙂

  33. […] Nach längerer Suche im Netz bin ich auf folgendes gekommen:http://chaotictech.wordpress.com/2008/03/28/k2-wordpress-25-broken-i-can-fix-that/&nbsp; -> besser der Code von hier  […]

  34. John Miller avatar
    John Miller

    ty for the fix, first result in google is <3

  35. Nate Reutter avatar

    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.

  36. Jeff the Great avatar

    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!

  37. Jeff avatar

    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.

  38. Stefan avatar
    Stefan

    Thank you very much!

  39. Ruthie avatar
    Ruthie

    One more person here who benefited from this fix. Thanks, Tom!

  40. kath avatar

    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

  41. John A avatar
    John A

    I can clearly say that the stable version of wordpress
    http://wordpress.org/download/
    and the latest K2 nightly build work nicely without any work around.

    The latest K2 nightly
    http://getk2.com/nightly/
    can be found here. The SBM is more stable too for sure now.

  42. WordPress 2.5 Fatal error: Call to undefined function wp_register_sidebar_widget() in…

    Во время обновления WordPress до версии 2.5, при входе в админку вылезла ошибка: Fatal error: Call to undefined function wp_register_sidebar_widget() in …/dashboard.php. Поиск в интерн…

  43. […] http://www.tomrafteryit.net/fatal-error-call-to-undefined-function-wp_register_sidebar_widget-in/ I followed the steps and managed to get into the admin interface for WordPress 2.5. But i am still getting weird code above the header and not being fluent in PHP like i would like to be i have few options…Look for a WordPress 2.5 version of K2 (will later) or change the theme… which i don’t want to do! […]

  44. […] a resolver este erro envolvendo o WordPress 2.5 e o tema k2. Para minha surpresa, rapidamente encontrei a solução no blog de Tom […]

  45. Paul Schutz avatar

    That’s a beautiful thing my friend, worked perfectly. Thank you.

  46. Danny Foo avatar

    Thanks a bundle for this fix, Tom.

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

    Regards.

  47. […] a solution online at the WordPress support. But the solution posted there came from another person; Tom Raftery. His research pointed him to another article relating to how the new K2 theme breaks WordPress […]

  48. Frisbee Fodder avatar

    Thanks for that, a simple fix which had me worried for a short while!!

  49. a.o avatar
    a.o

    Thanks alot !
    appreciate it.

  50. Tomas avatar

    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

  51. […] I have had to search on Google (so fast, in fact) about K2 wordpress theme, but someone else called Tom who has a very helpful blog, answer all my questions in just one […]

  52. gascoingne avatar
    gascoingne

    This man is too much.

  53. […] Za?iatok môjho nového blogu postihol menší technický problém. Ke?že som si nahodil najnovšiu verziu 2.5.5, a chcel som aj tému K2, ktorú som používal aj na starom blogu, nemohol som sa dosta? do administrácie. K2 téma sa totiž “nekamaráti” (neviem ako to inak popísa?) s poslednou verziou WordPressu. Zjednodušene povedané, K2 akosi nevie obslúži? widgety na hlavnej stránke adminu blogu, ?o som sa dozvedel tu. […]

  54. Tony avatar

    Hey Thanks for the help. Worked fine.
    K2 is now 2.5 stable.
    http://getk2.com/2008/04/k2-release-candidate-6-released/

    Thanks again.

  55. Kris avatar

    Thanks, you’re a life saver!

  56. fipsy avatar

    thanks, too! 😉

  57. ine avatar

    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).
    tx!

  58. Jeff avatar

    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.

  59. Amanda Walton avatar

    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.

  60. […] jedoch läuft sowas wie ich mitbekomme sollte anscheinend bei Apple, denn hier rief ich bei der Hotline unter 0800 2000 136 an und hoffte noch auf unkomplizierte Kulanz. Nachdem […]

  61. sterndal avatar

    hello!

    what if the fatal error is in the comment section?

    how do i fix that?

    thank you in advance!

    cheers!

  62. […] Dinge, die ich einfach noch zu erledigen hatte. Leider kam ich dabei einfach nicht dazu hier etwas zu posten. Ab jetzt, da die Tage wieder kürzer werden, die Schulzeit aber nicht schreibe ich […]

  63. […] jedoch läuft sowas wie ich mitbekomme sollte anscheinend bei Apple, denn hier rief ich bei der Hotline unter 0800 2000 136 an und hoffte noch auf unkomplizierte Kulanz. Nachdem […]

Discover more from Tom Raftery's Musings

Subscribe now to keep reading and get access to the full archive.

Continue reading