Site icon Nabtron

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!

Exit mobile version