Tag Archives: WordPress

Post navigation

My Regenerate Thumbnails WordPress plugin has passed 10 million downloads, with over 1 million active installs! I never believed a little plugin I’d write in my free time and release for free would ever get so popular!

I’m officially discontinuing my Viper’s Video Quicktags WordPress plugin. It was one of the first plugins I ever wrote over 10 years ago. Back then embedding videos into WordPress posts was a chore and so I wrote the plugin to make the life of authors much easier.

Unfortunately users of my Video Quicktags plugin have been forced to keep the plugin activated so that embeds in old posts continue to work. Without the plugin, the shortcodes that the plugin created would cease working. So recently I wrote and released a tiny replacement plugin that creates those same shortcodes but has the native WordPress embed functionality handle the actual embedding of content.

If you are a Viper’s Video Quicktags plugin user, then I strongly recommend that you install my new plugin and then delete Viper’s Video Quicktags.

Besides switching away from a plugin I no longer support, advantages of the replacement plugin are modern, HTML5 embeds instead of Adobe Flash as well as automatic width to fit most themes, rather than fixed width independent of what theme you’re using.

After four years at Automattic, you are given an awesome MacBook that has been customized by ColorWare to have a glowing WordPress logo instead of an Apple logo as well as being painted any color you wish.

My four year anniversary of being officially hired was last March (I was also on contract for 9 months) but as one of the handful of Windows users in the company, I originally opted to pass on the custom MacBook and stick with normal Windows laptops. I’ve used Windows for 20 years now and my primary machine is a very powerful desktop computer that I’ve built for gaming.

However I recently tried to use a Mac for something and realized that I had absolutely no clue how to use it. I didn’t even know about Finder! Yeah, pretty bad.

Additionally I saw some very cool looking customized MacBooks at my company’s annual full company meetup that made me want one too.

So I decided to get one after all and I’m super happy I did! It’s absolutely beautiful and I can install Windows on it so that I can use both operating systems.

In the latest episode of the great TV show Orphan Black, a character is searching for something on the Internet and is for some reason viewing search results in the form of HTML (ooo, what a hacker!). If you look at the stylesheet URLs, you’ll notice “wp-content”, a sign that it’s a WordPress-powered site!

Before you bother to check, the domain is registered in real life but there’s no site there, WordPress or otherwise.

For other sightings of WordPress on television, check out these posts.

The upcoming PhpStorm 8 features built-in WordPress support, as explained in this support document. However what’s the best way to set up your WordPress install in order to write plugins? Here’s my personal answer — feel free to suggest alternatives in the comments section.

When working on a WordPress plugin, you don’t want functions, classes, variables, etc. from other plugins to leak into your current plugin through auto-complete or other types of automation. For this reason, I suggest avoiding opening a whole WordPress checkout with all of your plugins inside of it using PhpStorm. At the same time, you don’t want to have a separate copy of WordPress for each plugin that you work on. This is redundant and makes keeping WordPress up to date harder.

So instead do a single checkout of WordPress to its own folder and then define WP_PLUGIN_DIR and WP_PLUGIN_URL, as described on the Codex, so that your plugins folder will live outside of your WordPress folder. This way you can open and index the WordPress folder without getting all of your plugins along with it.

Now create a new project for each individual plugin. When doing so, you’ll want to add the WordPress folder as an include path in PhpStorm, as described in their documentation.

All of this will result in only your individual plugin’s folder showing up in PhpStorm but with WordPress showing up under the “External Libraries” list. This one WordPress install can be used in your browser to test all of your plugins but the plugin codes won’t overlap.

Earlier today, a patch for WordPress that I’ve been working on got committed to WordPress trunk. “Trunk” is the in-development version of WordPress and will eventually become the next version of WordPress, in this case 3.7.

My patch introduces the ability to do complex date-based queries for fetching both posts and comments from the WordPress database. In the past, you could select posts that had a specific value for year, month, etc. but there was no way to do things like selecting all posts before (or after) a certain date or selecting all posts between two different dates. With my patch, this and more is now easily possible.

Additionally, all of the old-school date and time arguments for WP_Query are now handled by my code as well. They will continue to work as before and you only need to use the date_query parameter if you want more advanced control of your results.

If you use my SyntaxHighlighter Evolved WordPress plugin, please update ASAP. There’s a security issue with the Flash file that is used by version 2 of the highlighting library. This file is meant to be used for allowing one-click copying of the code to your clipboard (since normal copy/paste doesn’t work with it) but the file reportedly suffers from a cross-site scripting security issue.

Even if you use the better version 3 of the library (the default for my plugin), the file from version 2 of the library will still be included in the plugin’s files.

As a temporary fix, I have emptied out the file. This unfortunately means your visitors will not easily be able to copy any code you paste. I recommend switching to the superior version 3 via my plugin’s settings page. Code highlighted using the newer version can be selected and copied normally.

Feel free to leave any questions you have about this security issue on this post but please leave other general SyntaxHighlighter comments on the plugin’s homepage. Thanks.

I was debugging something in WordPress, trying to figure out what callback function was applying a change to a filter (in this case a post’s content). To get a list of what functions were hooked into the filter, I threw together a quick helper function and I thought I’d post it here incase anyone else found it useful.

If you’re writing WordPress code that makes remote requests and need to easily debug the requests, here’s some helper code to do it. This requires that you’re using WordPress’s HTTP API which you should already be doing — directly using cURL or other methods is wrong and a great way to make your code not cross-server compatible.

That will log the request URL, the request arguments, and the whole response HTTP_API object to your error log file. The last message one will be pretty long/spammy but it’ll give you headers, the body, and everything else. Since it’s an instance of HTTP_API, you can also do things like this if you want to:

I wanted to start contributing to the WordPress unit tests so I needed to install PHPUnit. Turned out it was harder than it might seem (I had a tough time getting it all working) so I thought I’d blog what finally ended up working for me to help save some people some time.

Assuming you already have PHP and MySQL installed, here’s the steps you need to take:

Open an administrator command prompt. Hit your Windows key, type “cmd”, right-click the resulting “cmd.exe” search result, and select “Run as administrator”. Navigate to the folder where you have PHP installed, the same folder where you saved the file in the previous step.

Type the following command to execute the file you just downloaded: php go-pear.phar

After a moment, you should start being prompted for some things. The installer is pretty self-explanatory and I think you want a system installation rather than a local one.

Open the folder where PHP is installed and double-click the PEAR_ENV.reg file that has been created. This allows you to run the pear command from any folder.

Verify PEAR is working by running the command pear version

Install PHPUnit:

Turn on auto_discover in PEAR by typing the following command at the command line: pear config-set auto_discover 1

Download and install PHPUnit by running the following command: pear install pear.phpunit.de/PHPUnit

In order to be able to run the phpunit command from any folder, you need to add it to your Windows Path value. Right-click My Computer → Properties → Advanced system settings → Environmental Variables → select “Path” under “System Variables” → Edit → Add a semi-colon (;) and then the full path to your PHP folder onto the end of the value, for example like this: ;D:\Webserver\php

Post navigation

About

Hi and welcome to my blog! My name's Alex Mills, although on the Internet I'm more commonly known as Viper007Bond (or just Viper). I'm a Portland, Oregon web developer who works for an awesome company called Automattic (you've perhaps heard of our WordPress.com blogging website). I contribute to the open-source blogging software WordPress and have written quite a few WordPress plugins. I'm also a big car nut who is really into Top Gear and run the show's biggest fan forums. You can read more about me on my about page.

Email Subscription

Enter your email address to subscribe to this blog and receive notifications of new posts by email.