Podcast Episode

324 – WordPress Debugging Plugins

Announcements

Is there a plugin for that?

With more than 50,000 plugins in the WordPress repository, it’s hard to find the perfect one. Each week, I will highlight an interesting plugin form the repository.

For more great plugins, download my 50 Most Useful Plugins eBook.

PlaceHold.it is not a WordPress plugin, but it’s a quick way to get sized placeholders for images on your website.

Your Website Engineer Update

  • Nothing to report on for Your Website Engineer. Did finish the website for LaDonna’s Classy Creations.

WordPress Debugging Plugins

Built in WordPress Debugging Tools:

  • WP_DEBUG define('WP_DEBUG', true);
  • WP_DEBUG_LOG define('WP_DEBUG_LOG', true);
  • WP_DEBUG_DISPLAY define('WP_DEBUG_DISPLAY', true);
  • SCRIPT_DEBUG define('SCRIPT_DEBUG', true);
  • SAVEQUERIES define('SAVEQUERIES', true);

WordPress Debugging Plugins:

Thank You!

Thank you to those who use my affiliate links. As you know I make a small commission when someone uses my link and I want to say thank you to the following people. For all my recommended resources, go to my Resources Page

Full Transcript

Business Transcription is provided by GMR Transcription.

In today’s episode, we are going to talk about 15 different testing and debugging plugins that we can do to create our perfect website, right here on Your Website Engineer podcast, episode number 324.

Hello, everybody. Welcome back to another episode of Your Website Engineer podcast. My name is Dustin Hartzler. Today we’ll be talking about all these plugins and even some built-in code that we can use to help – that WordPress can use to help us debug what’s going on on our server and what’s going on with our websites.

Before that, I do have a little bit of news that I want to share with you. There’s not a lot going on in the WordPress space. There’s some WordCamps that are happening in the next few weeks or so, but the big news that I saw this week is the commenting system Disqus, D-I-S-Q-U-S, is now – starting in March of 2017, they’re gonna be starting charging a monthly fee to remove advertisements from your WordPress comments. This is something that’s always been free to disable in the past, and it’s a big change that’ll affect thousands of businesses and bloggers that rely on Disqus to power their comments. That’s a news article that’s out there. I’ll link to it in the show notes if you want to read more about it. If you are using Disqus on your website and what this means to you, you’ll definitely want to check that out.

Like I said, that’s about the only news that’s out there this week. Everything else, our sites are just updated to 4.7.2 last week, and not really anything else going on in the Jetpack world. Not much going on in the WordPress community right now.

Let’s go ahead and just dive into is there a plugin for that? This time, in this section today, I wanna actually tell you about a service that’s not really a plugin. It’s not a plugin at all, but it is really neat and it can help you develop and build these websites, kinda like what we’re gonna be talking about today. This is called Placehold.it. This is a website where you go in. First you just go to Placehold.it and then it gives you a link that you can use to build a placeholder image for a brand new website. If you wanted an image that’s 200x200, you would create a link for your image, and it would be a placehold.it/200x200. You could put this in any image tag and it would automatically show up. Even in the boxes it would say ‘200x200’ or ‘350x150’ or ‘140x100,’ depending on what size and layout that you want. You can actually put HGTPS in there. It’s a secure URL. Then your page will load securely. This is a great tool that you can go and start mocking up a website very quickly and try to figure out what size of images that you’re gonna need for different pages.

This kinda goes in with my update for the week. I used this this past week because the website that I was building for the Detroit hackathon, I was able to finish this week, but I needed some placeholder images. I found this site just a really nice way to go in and add those placeholder images. The client for Ladonna’s Classy Creations, the website that I built, will have the ability to go in – oh, I need a 200x200 image and we can add this and put it right there on the home page.

That’s kinda the update for the week. I only had a chance to finish that website out that I started a couple weeks back; got that all done and shipped off and just waiting to hear back how it looks, if there’s any more small tweaks to do. Nothing else on the Your Website Engineer front. I do have a list of things that I need to accomplish this week that have been on my to-do list forever for my website. My goal is to knock down some of those tasks in the coming week. I’ll provide more updates next week, just to let you know what I’ve been doing in the website space for my own website.

Let’s go ahead and dive into the main topic of the show today. Like I said, we’re gonna be talking about the 15 plugins. But first, before we dive into plugins, I wanna talk about some of the things that are built into WordPress itself.

One of the big things that we wanna do if we’re building a theme or building a plugin is we want to make sure that we have some sort – we wanna be able to see what kind of errors or warnings may be happening in PHP. This is a part of any project. We wanna make sure that we are debugging it. We wanna make sure that we are not using deprecated functions or things along those lines. The tools that are built in is WP_DEBUG. This is a PHP constant. It’s basically used to trigger the debug mode without WordPress. It’s a line of code that’s in your WP-CONFIG file. You basically say ‘Define WP_DEBUG’ and turn it to True. It’s normally False by default. There’ll be a link to show notes for the actual code for these five things that we talk about right here at the top.

Basically, it will go on and debug and spits out all kinds of information. It will cause PHP errors, notices, warnings, all to be displayed. It’s also to likely modify default behavior of PHP, which will display fatal errors and shows white screen or death when errors are reached. This will just cause notices about deprecated functions and arguments within WordPress and what are being used. These deprecation notifications will often indicate new functions that should be used instead of the old deprecated functions. You turn on debug and it just spits this information out to your screen. It’s really helpful when you’re just getting started with that debugging, and you haven’t given it out the client yet and you’re just trying to figure out if everything is working as it should.

Now, there’s a companion to WP_DEBUG that’s called WP_DEBUG_LOG. This causes all errors to be saved in a DEBUG.LOG file inside the WP-CONTENT directory. This is really useful if you wanna review all notices later or if you wanted to view notices generated off-screen. Maybe if there is some sort of Ajax request going or you got WP-CRON running, this is just a great tool for this. You’ll want to enable WP_DEBUG_LOG to see those.

There’s also a WP_DEBUG_DISPLAY. This controls whether the display messages are shown inside of HTML pages or not. The default is True, which shows errors as they’re generated. You can set this to False and it’ll hide all errors. That’s another one you can use.

You can also use SCRIPT_DEBUG. This is a constant that will force WordPress to use the dev version of Core CSS and JavaScript files rather than the minified versions that are normally loaded. This is really useful if you were testing modifications in any built-in JavaScript or CSS file. The default setting for this is False and you can set it to True to turn this on.

The last one is SAVEQUERIES. This is a definition that saves the database queries to an array that can be displayed to help analyze those queries. The constant is defined as True – when it’s defined as True, it will allow each query to be saved, how long the query took, and what function called it. You can define, save queries, and then set that to True.

Those are the things that you can turn on within WordPress itself. Now, these will all have performance impact on your site, so you wanna make sure that these are all turned off when you are not debugging. Those are some things built into WordPress. I would say these are probably the tools that you want to do before your website is launched, while they’re brand-new and you’re debugging and setting up them up. You wanna turn these on and make sure everything you’re doing is working out really nice, and that you don’t have any errors or warnings. No warnings, for sure; no errors, for sure. That’s the first piece of this debugging puzzle. These are things built right into WordPress.

Now, when it comes to plugins, there are tons and tons of plugins out there, of course. I wanna highlight a few of them. The first one – all of these, except one, I believe, can be found on the WordPress repository. And of course, there’s links in the show notes in episode number 224 – or 324 for all of them.

The first one is called a Developer. This one is created by Automatic. It’s not really an end-user plugin but is a master plugin that helps you set up and optimize your development environment. Once you activate it, Developer will ask you what kind of stuff you’re developing, whether it’s plugins or themes, and then on the selection, the plugin offers you a list of useful plugins that you can use to activate with one click to help you do more work efficiently. If you are a theme developer, it will suggest you to activate Theme Check plugin, which we’ll talk about in just a few minutes. This is a master page. It will allow to activate/deactivate other developer-related plugins. Or if you’re just getting started, this is a perfect plugin to know and find some of those plugins that you may or may not need. Alright?

The next one we’re gonna talk about is called Debug Bar. It’s just a simple plugin that adds debugging menu to the admin bar. The debug menu can then show useful information, including details pertaining to the query that’s used and the cache that you can use. You can also keep track of all your MySQL queries and PHP error notices, as well. This is just a simple way – it displays some really nice information but it doesn’t go in depth, as the next one does.

The next one is called Query Monitor. This one is really intense and it can show you all kinds of things. It will let you look at all of the ongoing database queries, as well as showing you rows that are being affected. You can also view rewrite rules, the hooks that are fired on a current request, PHP errors, warnings, even template file names and parts. Also, you can use Query Monitor – I guess it’s one of the few plugins for developers that’ll allow you to keep track of Ajax calls, REST API requests and redirects. If you’re working with a WP REST API, Query Monitor will be very, very useful for you.

This is one that we use a lot with commerce support. You can go in here and you can see all the things that are going on. You can see the PHP warnings, slow queries, regular queries. You can see how many transients are set. You can see what functions are being called and when and how long they take. There is just an overload amount of information that is built into Query Monitor. If you need information like this, that’s definitely a plugin to install, a very, very powerful plugin.

The next plugin that I wanna talk about is called Theme Check. This is a theme developer’s best friend. It’s a very popular, useful plugin. It lets you test your WordPress themes according to the latest coding standards and practice. You can review and verify that your WordPress theme meets the theme review guidelines before you submit it to the repository. This way you can reduce the chance of your theme being rejected and you can adhere to the best coding practices. This allows and makes sure that your theme is up to date and up to the mark. And I believe Theme Check will also go in and scan themes that you’ve downloaded that aren’t on the WordPress repository. If you buy a one-off theme from somewhere, it will go ahead and it will notify you if there’s anything fishy going on in the theme.

One of the big things that it does look for is if there’s any static themes – or any static links inside of a theme. What this means is that we could have developers that are hiding or they’re trying to inject some sort of malicious links or affiliate program links inside of your theme. This will check and make sure there’s none of those involved in your theme. That is a great plugin.

Another theme-related plugin, and this is a good one for debugging – figuring out is it your theme? Is it plugins? What’s causing some sort of issue that may be happening on your site? That is called Theme Switcha. This is a plugin that will allow you to switch your theme, your default theme, to another theme when you are logged in as an admin. This will allow you to change themes momentarily so you can go in, you can do your debugging, you can figure out what’s going on on your site without your live site being affected. It’s a quick tool that you can use. You can actually even use this if you’re getting ready to switch themes from one theme to another. You can turn on Theme Switcha and you can start customizing your new site and your new settings on a new theme without affecting your live site as well, without setting up a debugging platform or a test site or things like that. That is another plugin that’s really, really nice.

Another one that kind of helps with building up a website when it comes to adding content to a website is called FakerPress. This is a clean way to generate fake and dummy content to your WordPress site. It’s great for developers who are testing. It allows you to create posts or custom post types and post metadata, featured images, users, tags, categories, comments. You can just add all this stuff instead of having text expander snippets or just typing a lot of random gibberish. You can go ahead and you can do all this. You can also delete all this content using FakerPress, that’s been created with FakerPress. So it’s really easy to spin up some content, see what it looks like with generated dummy content, and then you can deactivate and get rid of all that once you’ve set up your theme and your theme styling is exactly the way that you want it to look.

The next plugin that I wanna share with you today is called WPide. This is a WordPress code editor with auto-completion of both WordPress and PHP functions with references, syntax highlighting, line numbers, and tab editing.

This isn’t a plugin that I would recommend using all the time. Definitely, if you are building a website or a theme or a plugin, you wanna make sure that you are using some sort of code editor; it’s probably a little bit more best practice. But if you’re trying to do something quickly or you just wanna do it right from the WordPress dashboard, WPide is probably a perfect plugin for that. That will allow you to see as you type a function out, maybe WP_LINK_PAGES, that’s a function that’s built into WordPress that they have highlighted here in the WordPress plugin directory. It will go in there and will let you know what type of variables it’s looking for, how to use it, and things like that. That’s all built right in as you type. As you’re starting to type functions, it auto-completes. You can edit multiple files at the same time. It is almost like a code editor built into WordPress. If that’s something that you’re looking for, that would be a plugin to check out. That’s WPide.

User Switching is the next plugin. This one gives you instant access to switch between user accounts within WordPress. If you’re building a website, maybe a membership plugin, and you wanna have different access points. You have maybe three different levels that people have different access to different points; you definitely wanna test that to make sure that the right people have the right access to the plugins or whatever you’re offering on your website. User Switching is the perfect way to do that. You can do it from the user’s screen. You can switch back and forth very, very quickly from there. It’s secure and it’s compatible with WordPress, WordPress Multisite, BuddyPress, and bbPress.

This is really great if you’re running a website, too, and you’ve got a membership set up or you have some sort of community set up with BuddyPress and the person is complaining that they can’t see this or they can’t do that. If you wanna see what they’re seeing, you can go ahead and do a quick user switch and go directly to their account, which is really nice. That is User Switching.

Another one that is probably really good to use that I bet a lot of people are not using is called RTL Tester. This will test your themes and plugins in a right-to-left mode. This allows the admin bar – in the admin bar it adds a menu where you can switch the text direction from left-to-right to right-to-left. There’s a lot of languages that are not native to the Unites States or English language that do right-to-left mode, and you wanna test and make sure that everything looks good in a right-to-left mode. That is another plugin.

We’ve got just a handful more of them here.

The P3 Profiler is one that I like using, as well. This is a good one to go in and see what plugins are slowing down your site. It creates a performance report for your site. It lets you know how much time each plugin’s taking to load. It’s a pretty simple plugin. This is actually one created by GoDaddy. It’s got more than 100,000 active installs. This is one that you probably turn on, you run, you see what’s going on, and then you can de-activate and get rid of on your site. That’s probably the case with a lot of these, especially as you’re debugging. They’re perfect for that but they don’t necessarily need to be running on a live website.

Another one that’s really nice to get started with, especially if you’re using – you’re getting things configured; you’re building a demo site for your theme or your plugin; you’re trying to put all the settings in and doing all that kind of thing. There’s a plugin called WordPress Reset. This resets the WordPress database back to its defaults. It deletes all customized content. It does not modify any theme files; only resets the database. It gets rid of all of the users you’ve created, the comments, the widgets, all of that stuff. It just sets it back to brand new. It’s a simple plugin, but that’s exactly what it does. It’s called WordPress Reset.

Another one that I really like and this is great for theme developers or somebody that may be creating a child theme or just trying to figure out where this file is coming from on a WordPress site, this is one called the What The File. It is the best tool to find out the template parts that are used to display the page that you’re viewing. It’ll add this up in the menu bar. It’s in the upper right hand side next to where it says “Howdy, Dustin,” or “Howdy, your log in information.” Up there in that part on the black admin bar, it’ll say ‘What The File’ when you’re viewing a website page. Then you click on that and it’ll show you all of the template files that are being called. It may just say INDEX. PHP but it may say INDEX.PHP and CONTENT-INDEX.PHP and LOOP-… It’ll have all of these template parts, so you know exactly what pages are being used and what template files that you should be modifying and changing, if that’s something that you’re looking for. Okay?

Two more, three more that I wanted to share. One is called My Custom Functions. There’s a lot of plugins out there like this. This was one that’s more heavily actively used. This one will allow you to easily and safely add your custom functions directly to your WordPress dashboard without the need of an editor. This allows you to put FUNCTIONS.PHP code in a place that’s not in your FUNCTIONS.PHP. You can monitor and use that all within the WordPress dashboard. That’s a really great plugin, as well.

The next one is called Mex Quick Plugin Disabler. This is one that you can temporarily disable and restore all actively current plugins with a single click. If you’re in a debug mode and the first thing they say is ‘Turn off all plugins,’ it adds a link underneath the plugin section, the title right there at the top of the page that says ‘Temporarily disable all active plugins.’ You just click that and it turns them all off. When they’re all deactivated you can click ‘Restore disabled plugins’ and it turns them all on. It’s extremely helpful, especially if there’s hundreds – some websites we log into, they’ve got hundreds of plugins. You wanna turn them all of really quickly? This is the plugin to do that.

Then the last one is a plugin created by one of my colleagues. It’s called WP-CRON Tester. This was the only plugin that can be found in GITHUB only. You can go to GITHUB and you download it. It basically tests and makes sure your WordPress CRON service is running okay. It adds a CRON job and displays debugging content on a single post page. It gives you information like the CRON job timestamp. It lets you know if it’s working or not and all that good stuff. So, if you’re interested in that, you can see that. Sometimes things don’t happen on your website if the CRON’s not running right or whatnot. This is a good plugin to use to test that.

That’s a mouthful. That’s a lot of plugins to use. Again, I recommend using only a handful of them for your specific use. If you’re developing a plugin, you obviously don’t need the ones for switching themes and checking your themes and things like that. But those are the plugins – have I missed any? If you have a plugin that you use to help you develop or debug or try to figure out what’ going on in your website, definitely let me know. Leave a comment in the show notes for episode number 324.

That’s what I want to share with you this week. That’s another, a big piece of the WordPress puzzle, the tools that we need to develop and use. That’s what I wanted to share with you this week. Until next week, we’ll all talk again soon. Take care. Bye bye.

    • Tony Hayes Reply

      One of the things I always found frustrating, especially when starting out with WordPress and trying to debug a fatal error (during customer service for example) was finding out where it was coming from fast… I wrote a simple plugin to search for the error string (eg. function) to locate it amongst the (sometimes mess of) installed plugins and themes… I have continued to use and improve this plugin over time and finally made it available on the repository, thought I’d add it here in case anyone was looking for further debugging tools: http://wordpress.org/plugins/wp-bugbot/

      Apr 3, 2017
      • Dustin Hartzler Reply

        Way cool Tony! I’ll be mentioning on this week’s show 🙂

        Apr 10, 2017

Leave a Reply to Tony HayesCancel reply