• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Dave Buesing

SEO Manager by Day, Comic Book Blogger by Night.

  • Blog
  • Contact Me
    • Freelance Comic Book Writer & Blogger
    • Freelance SEO Consultant
You are here: Home / Uncategorized / Quickest Possible Way to Deal With PHP Error on Your Wordpress Blog

Quickest Possible Way to Deal With PHP Error on Your WordPress Blog

June 4, 2014 by Dave Buesing 9 Comments

There are certain “polite observations” that are mildly infuriating, and then there are polite observations that genuinely help. An example: over on Comic Book Herald, a reader recently sent me an email with a list of comic book events I’m missing. Not “Hey, I think it’d be cool if you added these,” but just “You’re missing x, y, and z. You nose-faced loser.” Ok, I added the loser bit, but the tone was pretty clearly dissatisfaction at not receiving a free thing.

Over here, though, I had a reader kindly jump in and alert me to a giant PHP warning gracing the header of davebuesing.com like the world’s techiest pimple. I had no idea, and was a bit startled to find the following warning for all to see:

Warning: Creating default object from empty value in /folder/specific/to/your/site/theme/admin-hooks.php on line 160. We’re all gonna die!

php-wordpress-home-page-warning

It’s the end of the world as we know it…

As a relative noob to php I found the above warning pretty distressing. I’ve dealt with warnings inside my WordPress admin before, but never so publicly. Adding a PHP warning to your blog blanner is a pretty bold declaration of cluelessness and hackability. “Hey guys, I’m great at internet stuff! Don’t mind the “doom is upon us” warning at the top of the blog!”

After a whole bunch of research, though, I was able to find a remarkably quick “solution.” I air-quote solution for reasons that will become apparent in a moment. For now, the answer:

Add “error_reporting(E_Error);” to your PHP file sending the warning

php-error-removal-wordpress

PHP!

To add this little line of code, you just need to access “Editor” in WordPress, and pull open the PHP file referenced in your warning from there. I added the code after all the file notes and before the first If statement, and I have successfully removed my error from the home page.

Note: It’s pretty foolish to add stuff willy-nilly to your live PHP files in editor. Ideally you would test this out on a localhost first. Or you can be like me and live on the edge of tomorrow #cruiselife

Now, if you happen to know a little something about something, you’ll pretty quickly realize this is basically just a band-aid that hides the warning. Again, it’s not a solution to the PHP error, so much as it is the removal of error messages on your blog homepage.

As I said, this is the quickest possible way to just get that gunk off your blog. If you find that functionality is lacking, or that things on your site are broken, clearly you’ll need to explore the PHP error in more detail. Forum explanations of all this are very tricky, and usually pretty specific to the site facing the warning. I’d start with the likely source of your problem, your server’s recent upgrade of PHP that you ignored because surely nothing would go wrong.

In the meantime, enjoy the error free homepage!

Filed Under: Uncategorized

Reader Interactions

Comments

  1. Joao says

    April 16, 2015 at 4:20 am

    You saved my life!

    Reply
  2. Neil says

    May 14, 2015 at 3:05 pm

    Great it works! Thank you very much.

    Reply
  3. Godly says

    January 8, 2016 at 1:46 pm

    Its the quickest I agree, You’ve prevented a heart attack! Thanks

    Reply
  4. Nana says

    February 10, 2016 at 2:31 pm

    Awesome! THANKS! woohooo!

    Reply
  5. Diego says

    March 3, 2016 at 7:31 pm

    Are you the best!!

    Reply
  6. Anne Therkildsen says

    December 1, 2016 at 1:20 pm

    Amazing, THANK YOU so much!!!

    Reply
  7. Thomas says

    December 17, 2016 at 9:31 pm

    Me not helped :/ only not see that message and that is all. But cant add a post or page

    Reply
  8. putra says

    May 24, 2017 at 2:00 am

    Great it works! Thank you very much.

    Reply
  9. Tad Mcgee says

    January 14, 2019 at 9:35 pm

    This is not a fix. Only hide the message…

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Welcome!

Follow @davebuesing

Recent Posts

  • What To Do About Search Traffic You Don’t Actually Want!
  • My Google Search Results Say “No Information Available”… But I’m Not Blocking Via Robots.Txt!! What’s Up?!
  • Quickest Possible Way to Deal With PHP Error on Your WordPress Blog
  • How To Implement Google Analytics Demographics Reports
  • You Can’t Spell Marvel’s Agents of S.H.I.E.L.D. Without SE… Oh

Copyright © 2021 · Genesis Sample Theme on Genesis Framework · WordPress · Log in