How to fix WP Fatal error: Call to undefined function use_codepress() in */wp-content/themes/thesis_17/lib/admin/admin.php on line 42

So you recently updated your WordPress installation from 2.x (probably 2.9.2) to WordPress 3.0 and while trying to edit some custom file for thesis theme you received this error making your throat get dry? (don’t worry we will discuss a fix here  – and yes it is different from some other sources out there – including thesis official site patch)

Fatal error: Call to undefined function use_codepress() in /<wp root>/wp-content/themes/thesis_17/lib/admin/admin.php on line 42

This error is due to the fact that WordPress 3.0 has deprecated the use_codepress() function. Ideally the so called so PRO and fast thesis theme team should have pointed out this error (along with many many other out there) and fixed it themself by releasing a patch update to their so called brilliant theme (no doubt it is, but it lacks alot too – ya i am using it too :p) So anyway, here is how we fix this issue in the thesis 1.7 theme after upgrading to WordPress 3.0:

Goto your server root (via ftp or via cpanel – file manager) and browse to the directory listed in error that is:

<wp root>/wp-content/themes/thesis_17/lib/admin/

And open this file to edit: admin.php

Before making any changes to the file stated above to remove the fatal error for use_codepress() function in wordpress 3.0 with thesis theme custom file editor page, make sure you back this file (back up by simply saving it on your computer by downloading or else zipping the file on the server itself)

In that file look for line number . . . umm ofcourse 42! as that’s what error tells you, and comment this line out (it’s ok if you are not programmer and don’t know how to comment a code line. adding double slash before a line “//” is called commenting it out (atleast in PHP). There are other ways too btw. Or you can simply replace the line 42 that is:

if (use_codepress()) add_action('admin_print_footer_scripts', 'codepress_footer_js');

With this:

// if (use_codepress()) add_action('admin_print_footer_scripts', 'codepress_footer_js');

By the way, this is the fix that you will be seeing on many other websites too maybe to patch up thesis theme to avoid the fatal error. however this patch removes the ability to use the use_corepress() error permanently. To keep it there for any future miraculous release of wordpress which may re enable it, instead of replacing it with the line of code above, replace it with:

if (function_exists('use_codepress')) {
	if (use_codepress()) add_action('admin_print_footer_scripts', 'codepress_footer_js');

And now save the file.  Goto the custom file editor for thesis 1.7 theme in wordpress 3.0 and voila! no more call to undefined function fatal error due to use_codepress() function deprecation anymore!

33 comments on “How to fix WP Fatal error: Call to undefined function use_codepress() in */wp-content/themes/thesis_17/lib/admin/admin.php on line 42

  1. Awesome, thanks! I have a thesis wordpress blog with the same problem and it’s now working just fine. I am quiet disappointed that the Thesis team hasn’t fixed that thing, I guess it would take them less than 30 minutes to do it in their source code, upload the fixed file and spare people like us the time to have to deal with this ourselves :-( I don’t know how many customers they have, but judging from there popularity it’s tens of thousands of sites, and if each one just uses 30 minutes to fix this, then this adds up to thousands of hours of lost productivity because they don’t get moving… sorry, wrong place to vent my frustrations… I should say instead: THANKS NABEEL!!!

    1. Thesis theme has many other bugs and design flaws too. Hopefully I will be launching a better theme (improved seo and bugs and error removed / reduced version) as alternate to thesis (ofcourse for free) soon. I know there are themes already available which are much better than thesis in some situations, but i am interested to code a similar functionality with a different approach.

  2. Nabeel, thanks for the solution — just what I needed!

    Now, for DIYThemes to make Thesis compatible with WordPress 3.0’s custom navbar menu feature…

    1. :) you’re welcome,

      and there are a hell lot of modifications that are needed to thesis to make it compatible with google’s new guidelines, including inappropriate css.

  3. Nabeel,

    Could you please help me and I will pay you. I’m having the “fatal error” issue on my website (please see above). I can’t locate the programmer who installed the website using WordPress and the web designer and I have had a huge argument. I really need the website up and running and don’t want to lose the entire data. The server is on I’d be forever grateful if you could get my website back.

    Very humbled and desperate.


  4. Help!! I love your article and I understand what you are telling us in order to fix the problem but I cannot find the error on line 42 for me. I go the admin.php on my cpanel but there is nothing there or even on the entire form, that is close to the error. What should I do? Am I doing this right? Please help!

    1. there is nothing specific like “php editing software”

      you simply need to edit it with any text editor or code editor is better too

      if you want me to do it for you, please let me know!

  5. You, my friend, are a god! Perfect instructions. Fixed it first time through without any screwing around or guessing what you might have meant. Thank you so much!

Leave a Reply

Your email address will not be published.