Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 116 of 219)

Articles, tips, and resources for WordPress-based development.

How To Display The Last WordPress Query

Have you ever had the, ahem, pleasure of customizing the WordPress query? One of the most useful things in debugging is displaying the last WordPress query.

Let’s say you’re working with taxonomies and/or post types and you’re passing custom parameters around. And then, you want to setup some debugging to see exactly what’s hitting the database.

This is helpful for a variety of reasons if for no other reason than to see what is running against the database. It gives you insight on what you’re requesting and thus what you’re presenting to the user.

Anyway, writing code to do this is easy.

Continue reading

WordPress Options and Theme Modifications

When The Customizer (once called The Theme Customizer) became part of WordPress, we saw a resurgence in the Theme Modification API.

The Theme Customizer

At one point in WordPress history, the get_theme_mod and set_theme_mod was how we handled theme modifications (hence the function names). Then, we began to use the options table as a way to manage the various settings for our plugins.

And then we began to use the options table as an easy to way to store settings for our themes. It was like we moved the Theme Modification API to the backseat and pushed forward with options.

Should we have done that (or does it even matter)? And what’s the difference in these APIs, anyway? Why do we still have both of them, which is best to use and when?

Continue reading

Debugging Minified Files in WordPress

As much as I’m a proponent of concatenating and minifying dependencies, it’s not without challenges. Sure, this is includes both stylesheets and JavaScript, but I’m specifically talking about debugging minified files in WordPress.

Debugging Minified Files in WordPress

A minified bug. Get it?

It’s one thing to have your JavaScript files separated and organized in your Development. But when it’s time to deploy to Production, you should be aiming for a few minified files.

For example, say a client contacts you claiming something on their site isn’t working? You load up the site, you check the browser console and see there’s an error in the JavaScript.

Wait. You’ve minified all the files.

So what now?

Continue reading

Keeping Separate Files for Ajax in WordPress

When working with Ajax in WordPress, the general setup is pretty straightforward:

  1. Register the `ajaxurl`, if needed
  2. Define the hooks (or the callbacks) on the server-side
  3. Register and Enqueue the JavaScript files
  4. Have your JavaScript file(s) call to the defined server-side hooks
  5. Update the front-end as necessary

And the front-end may refer to the Dashboard, the public-facing part of the blog, or the both. It depends on the nature of what you’re working on.

If you’ve worked with Ajax in WordPress in-depth for any amount of time, then you’re likely familiar with the above process. You’re also familiar with the challenges of maintenance depending on how the code was setup.

If you’re just getting started, then perhaps this post will help shortcut some of the learning the rest of us have had to do.

I don’t think the Ajax APIs are that bad. I know – this is subjective. But from the a maintenance standpoint I believe that there’s at least one thing we can do to make development and maintenance easier.

Continue reading

Why I Recommend SearchWP

For a few years now, I’ve been using SearchWP on this and on a few other sites I’ve either built or had a hand in improving.

SearchWP

Most people who are active in the WordPress development space are aware of this plugin (at least, I think they are), but if you’re someone who’s not involved with WordPress at that level and are looking for a way to improve the search functionality of your site, then I can’t recommend the plugin enough.

Then again, even if you are a developer and you’ve never used it, the same sentiment rings true.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑