The Developer’s Toolbox: Query Monitor, Advanced Custom Fields, WP-CLI and Redirection

Four tools that save time in everyday WordPress work: debugging, custom fields, the command line and redirects.

Anyone who builds or maintains WordPress sites regularly collects a few tools that always come along. Here are four that we think many people will find useful, even though only three of them are plugins in the usual sense.

Query Monitor – see what the page is actually doing

Query Monitor adds a panel that shows database queries, PHP errors and warnings, hooks, HTTP requests, loaded scripts and much more for the page you are viewing. You can see which queries are slow and which plugin or theme is behind them. When a site feels sluggish, it is often the first thing we install on a test copy. Don’t leave it active on a live site longer than necessary, because it shows technical information that should not be available to everyone.

Advanced Custom Fields – structured content

Advanced Custom Fields, often abbreviated ACF, lets you add your own fields to the editor: a date, an image, a relationship to other content or a repeatable group. This makes it possible to build content that is structured instead of one big text box. There is a free version and a paid version with additional field types. Consider whether the fields should be defined in code in a theme or plugin, so that they don’t disappear if someone clears out the settings.

WP-CLI – WordPress from the command line

WP-CLI is not a plugin but a command-line tool. With it you can update plugins, create users, run search-and-replace in the database, clear transients and handle many other tasks without clicking around in the admin area. It is especially valuable when you need to do the same thing on several sites or script routine tasks. Many hosts have it installed. Always check that you are running the commands against the right site, and take a backup before making changes to the database.

Redirection – keeping your addresses in order

When addresses change, for example during a restructuring or a move, old links need to point to the new ones. Redirection manages redirects and logs 404 errors, so you can see which broken links visitors actually hit. You can create rules in the admin area without editing server files. Use permanent redirects when a page has moved for good, and make sure you don’t build chains where one redirect leads to the next.

Overview

ToolTypeUsed for
Query MonitorPluginDebugging and performance analysis
Advanced Custom FieldsPluginCustom fields and structured content
WP-CLICommand-line toolAdministration and automation
RedirectionPluginRedirects and 404 logging

Our tip

Development tools belong in a test environment. Build and debug there, move the changes to the live site only once they are tested, and keep the toolbox as small as possible in production. Enable error logging instead of displaying errors on screen, and consider setting up a routine for removing debugging tools when you are done.

You can find more plugins in the directory at wordpress.org/plugins.

A Greater Star

Need help with your WordPress site?

The people behind this site build and look after WordPress sites every day at A Greater Star – new sites, custom plugins, support agreements, hosting, security and speed.