Bart has been teaching you and me for many years now. Between his Taming the Terminal series and now his Programming By Stealth series, he’s attempted to cram vast amounts of knowledge into our brains. My father used to say that children are like wine bottles – you should pour as much information into them and while most spills off around the sides, but some gets inside every time you try. That’s definitely true with Bart and me.
Often when Bart is teaching me, I often wonder when I’m ever going to apply what he’s trying to teach. This week I had an epiphany about all this and I wanted to tell you about how it played out.
I create the blog at podfeet.com using the open source content management system, WordPress. WordPress runs on what’s called the LAMP stack, a combination of the Linux operating system, Apache web server, MySQL as the database and php as the programming language. Hence, LAMP. You can also run it on Windows or Mac where it’s called WAMP or MAMP respectively, but most people run WordPress on Linux.
The words I type, the photos I upload, and the links I include in the blog posts all get shoved into the MySQL database. From there, the look and feel of the display of the text, photos, etc is all controlled by the WordPress software through the theme you choose. The theme is written in the programming language php, or the “p” in LAMP and using CSS, or Cascading Style Sheets. It’s through the theme that you control whether a site has a left or right sidebar, what color and size the headings are, how the menus are displayed.
On top of the theme, you can also install plugins that also modify the way things work on a website. For example, Most people use a plugin called Akismet to control spam comments. At any given moment I have at least 15-20 plugins running to manage various things on my website.
Bart keeps telling me a good idea not to have too many plugins running because sometimes there are unintended consequences due to interactions between the plugins. I try really hard not to add new plugins but they’re so often useful that I add more than I probably should.
Bart taught me most of what I know about WordPress. I did get early instruction from my buddy Niraj, and Helma has been a huge help more recently with CSS of course. Bart taught me how to install WordPress on my Mac to test new ideas. He taught me about the database and what it means. He taught me about themes. He taught me about plugins. Without Bart, Podfeet.com would not be what it is today.
The problem to be solved
According to the web technology organization w3techs.com/…, which surveys the top 10 million websites every single day, WordPress now powers 30% of the websites on the Internet. If you just look at sites that use content management systems, WordPress has a 60% market share. Because WordPress is so dominant, they’re a very juicy target for cyber attacks.
How many times have you heard Bart say, “Stay patched and stay secure?” And you’ve heard him talk frequently about attacks on WordPress during Security Bits. For minor releases of WordPress, I have podfeet.com set to update automatically and I update the plugins manually and without question as soon as I see the little badge light up saying there is an update.
Remember how I said Bart advises to keep your plugins to a minimum? Sometimes these WordPress updates can cause conflicts, either with the theme you’ve chosen or one of your plugins or even both. Having a site down because you applied a security patch is distressing, but trust me, it’s still way better than having malware injected into your database. I had to clean up a website I’d neglected once before and I’ll never go through that again.
When WordPress 4.9.6 came out, it caused a failure on podfeet.com. It was really just of an inconvenience, but here’s the problem I needed to solve.
After I write a blog post, I make sure all of the images are well placed, I let Grammarly tell me where I missed commas or had extra ones, I verify all of the links and let Steve do his quality control thing. Finally, I hit the publish button in the web interface of WordPress. Normally when I do that, the web interface refreshes, taking me back to the WordPress interface. The publish button changes to say update for future changes, and WordPress reviews a View Post link.
However, after the WordPress 4.9.6 update, when I hit publish on a blog post the web page simply goes blank. Bart taught us that if you turn on the developer tools in your browser, you can use the web inspector to see what’s going on. I tried that with this blank page, but oddly the web inspector was empty except for a header and body tag.
Support for WordPress is through the community since it’s an open source platform. I described my problem in the WordPress.org forums, and I got the answer I expected. It was suggested that I change my theme to the default and turn off all of my plugins. This is just a wee bit of a sledgehammer approach, while I was hoping to use a scalpel on the problem.
Changing the theme is a quick click of a button, test, and put the original theme back, so it’s not really that hard. Reluctantly, I toggled my theme from my lovely Site Origin North to the reference Twenty Seventeen theme.
Changing the theme didn’t fix the problem, and surprisingly caused some problems I wasn’t expecting. Built into the newer versions of WordPress are some customizations. For example, I don’t have any sidebars on my new design, but I do have a footer with widgets in them. Flipping the theme over and back borked several of the customizations in an unexpected way, including moving my footer into a right sidebar.
@GrowlyBear saw my distress on Twitter and jumped in to help, and I was able to sort things back to the way they should look.
But I still had my original annoyance. I really didn’t want to turn off all of my plugins to test for the failure. I have a fair number of plugins installed but not active. Sorting through which ones were supposed to be off and which ones were only recently turned off would be a big slog. I contemplated putting them all in a spreadsheet, or printing the whole mess to PDF and scribbling on it but none of it sounded like a good, geeky solution.
Alex from Site Origin, my theme developer, suggested a path that sounded much more fun. Remember that the blank page I get after posting shows pretty much nothing in the web inspector? Alex suggested I enable the debug option for WordPress. He sent me a link to the WP_DEBUG instructions over on wordpress.org with a disclaimer that I might need some help. I appreciate that he doesn’t know my skill level, since he doesn’t know I’ve been learning from Bart all these years.
In reading the instructions Alex sent along, I learned WP_DEBUG is a single line of text that you insert into the wp-config file. I was of course extremely comfortable FTP’ing into my website, drilling through the WordPress directories, opening wp-config and inserting the line:
define( 'WP_DEBUG', true );
After editing config.php file, I tried publishing a blog post, and I was rewarded with a beautiful message on screen that started with, “
Fatal error” and ended with “
search-everything.php“. Search Everything is a plugin I use to enhance the way the built-in WordPress search works in WordPress. Now I had only one plugin to toggle off, and sure enough that fixed the problem.
But that wasn’t enough for me. I went to the plugin developer’s page and tried to find a place to write to the developer about the issue. Instead I found a discussion forum where a few people were talking about this very problem.
Unfortunately, It looks like the developer of Search Everything hasn’t updated the plugin in over a year, so it’s quite neglected. With Bart’s Security Bits hat on, he advises that plugins that aren’t kept up to date are also security risks. Obviously, I have to move along and find a new plugin for this functionality, but I did have great fun hacking the code.
I wanted to write this up to thank Bart for the foundations he’s given us in so many fields. My ability to solve this problem didn’t come in one lesson, it came in many lessons stretched literally over years. It came with patience on Bart’s part as he explained things in the podcast plus the time he spends writing up his extraordinary tutorials. It came with his desire to share his vast knowledge with the community. He gives us power, and that’s a great thing.
Bottom line is, listen to Bart, he’s really a smart guy.