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:

< ?php
if (get_option('k2sidebarmanager') == '1') {
	remove_action('plugins_loaded', 'wp_maybe_load_widgets', 0);
}
?>

to

< ?php
if (get_option('k2sidebarmanager') == '1') {
	remove_action('plugins_loaded', 'wp_maybe_load_widgets', 0);
  if( is_admin() )
	{global $pagenow; if( $pagenow == 'index.php' ) wp_maybe_load_widgets();
}
}
?>

Your dashboard should now be browsable once more!

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

43 Responses to “Fatal error: Call to undefined function wp_register_sidebar_widget() in…”


  1. 1 Conor O'Neill

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

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

    Still, the 2.5 upgrade seems really nice.

  3. 3 Donncha O Caoimh

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

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

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

  6. 6 kobak

    The recent svn version fixes the problem.

  7. 7 Tibor

    Thank you so much for finally showing up in Google ;-)

  8. 8 John A

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

    Thanks for being so unfunny.

  9. 9 Jerome Pearce

    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.

  10. 10 Tom Raftery

    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.

  11. 11 Jaroslaw Dobrzanski

    Tom, thanks for the solution!

  12. 12 cubus

    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 ;)

  13. 13 Jaroslaw Dobrzanski

    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 :)

  14. 14 Wags

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

  15. 15 Jeff

    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…

  16. 16 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 ?

  17. 17 Jerome Pearce

    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

  18. 18 Peter Reid

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

  19. 19 Kevin

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

  20. 20 Dave

    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.

  21. 21 hemineko

    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.

  22. 22 Linharex

    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.

  23. 23 Tom Raftery

    Linharex,

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

    Cheers,

    Tom

  24. 24 Shaun

    Thanks for the fix, I was starting to panic! :)

  25. 25 John Miller

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

  26. 26 Nate Reutter

    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.

  27. 27 Jeff the Great

    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!

  28. 28 Jeff

    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.

  29. 29 Stefan

    Thank you very much!

  30. 30 Ruthie

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

  31. 31 kath

    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

  32. 32 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.

  33. 33 Paul Schutz

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

  34. 34 Danny Foo

    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.

  35. 35 Frisbee Fodder

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

  36. 36 a.o

    Thanks alot !
    appreciate it.

  37. 37 Tomas

    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 :P

    Kindest regards from Argentina

  38. 38 gascoingne

    This man is too much.

  39. 39 Tony

    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.

  40. 40 Kris

    Thanks, you’re a life saver!

  41. 41 fipsy

    thanks, too! ;)

  42. 42 ine

    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!

  43. 43 Jeff

    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.

  1. 1 WordPress Upgrade Woes at sionide.net
  2. 2 Error al entrar en el Tablero de WordPress | Un Punto Naranja en la Red
  3. 3 Fatal error: Call to undefined function wp_register_sidebar_widget() in … | Blinded by the lights
  4. 4 Wordpress 2.5 at 坦然沒有藉口
  5. 5 Cuidado ao atualizar para o Wordpress 2.5 | Israel Junior
  6. 6 WordPress 2.5 en de K2 sidebar manager op TibsBits
  7. 7 Aux users de WP2.5 et de K2 - Miniping’s Blog & Life
  8. 8 Fatal error: Call to undefined function wp_register_sidebar_widget() in k2 (WP2.5) at I Press
  9. 9 Folgendes bekam ich angezeigt auf kikamagazin bloggt
  10. 10 Утилиты для CMS - систем управления контентом
  11. 11 Wordpress 2.5 upgrade with dreamhosts (if your using K2 theme) at Geekfreak.co.uk
  12. 12 Wordpress 2.5, o tema k2 e o erro do arquivo “dashboard.php” | desenvolvimento para web
  13. 13 Wordpress 2.5 Fatal Error wp_register_sidebar_widget
  14. 14 My logo idea at Tomas Roggero
  15. 15 K2+Wordpress 2.5: nie prílíš ve?ký kamaráti at Samuel Kolesár
  16. 16 How To Fix Call To Undefined Function Problem When Using Plainbox Or Other K2 Family Themes at Stayin Fresh

Leave a Reply




Tom Raftery’s Social Media is Digg proof thanks to caching by WP Super Cache!