Fatal error: Call to undefined function is_admin()

Have you meet a wordpress problem like this? Fatal error: Call to undefined function is_admin ()

I don’t know what I did prior to this but when I opened my test wordpress site in my laptop using MoWeS Portable by writing on the URL box on the browser:

fatal error call to undefined function is admin

the browser immediately whirred into energetic action and tried to wow me into ecstasy by displaying a snow white page with only one line on top saying:

Fatal error: Call to undefined function is_admin() in … …/wp-includes/vars.php on line 16

Fatal error: Call to undefined function is_admin() in

After recovering from the initial shock, and pulling myself up from the denial stage that followed, I immediately looked under the hood and inspected the concerned file on line 16 and found nothing out of the ordinary there. It was akin to me (who knows little about engines) looking under the hood of a car and seeing nothing wrong because there was nothing loose or swinging out of its proper place in there. Of course, broken spark plugs don’t give you a hint if you base your diagnosis on just looking at the engine and its periphery. What I mean is that having little knowledge of PHP, I can’t actually see anything wrong with the codes I saw back there, because I have no idea what those codes do.

Anyway, a little googling gave me the idea to replace the culprit file (vars.php) with a fresh unadulterated copy. That didn’t seem to do any thing, so I copied the whole wp-includes folder and did a copy and replace on my testsite’s wp-includes folder. It worked! I mean the “is_admin()” error was gone. It was replaced however by “is_multisite”.

Fatal error: Call to undefined function is_multisite()

Fatal error: Call to undefined function is_multisite() in blahblah…

So, expanding on the idea I got from my google research, I again did a ‘copy and replace’ using the latest version of wp, this time, on the whole wordpress folder, except for the existing subfolders (wp-admin, wp-content, wp-includes), and the wp-config.php file which I left untouched.

Everything went back to perfect working condition thereafter.

Of course, I had no qualms doing a ‘copy and replace’ because I was just working on a test site within my laptop using MoWeS Portable. I had nothing to loose should things go south from there. When it comes to the real thing, the best solution would be to simply update wordpress from the dashboard, or re-install it. Based on some discussions in wordpress.org forums, updating wordpress will work in your actual wordrpess site.

Speaking of updating in the dashboard, I still have another problem which updating didn’t seem to solve. It’s got to do with the ‘publish’ and ‘update’ button in the dashboard – the one you push when you’re done with your new post and want to publish it online. It does publish the post, alright, but the dashboard interface goes awry and I had to click the ‘Back’ button to bring it back to the real world. I’ll do a post about it once I find a solution.

Related Video: Call to undefined function