Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 19 of 219)

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

Introducing Remove Empty Shortcodes

Last week, I discussed everything that went my decision on retiring site memberships. For those who were members (or even read the initial idea), you may recall that I was using Restrict Content Pro to power the site.

When retiring the memberships, I wanted to make sure I was able to maintain the integrity of all of the posts that I’d published simply without the shortcode that comes with RCP.

What started off as a simple plugin to remove the RCP shortcode turned into a plugin to remove all empty shortcodes. I’m opting to open the plugin’s repository so anyone can access it (or contribute issues, code, or create their own fork from it).

At the time of this writing, the plugin is at 0.4.0 so there’s not much to expect. But I enjoy reading the what and why other developers do in their projects, so I’m going to do so with Remove Empty Shortcodes.

Continue reading

You Should Be Using PHP Filtering Functions, Part 2

In the previous post, I talked about the reasons using PHP filtering functions is more useful rather than not.

In short, doing so helps to provide a level of validation that’s built into the language so that we don’t have to re-write something. Naturally, there are caveats.

For example, if you’re having to validate a value that is of non-Latin characters, then you’re going to go have to go it alone and implement validation with perhaps a regular expression.

But if you’re using email addresses, URLs, numbers, IP addresses, and so many more things, then you’re in a good position to use something that already exists.

Anyway, all of the above is still about filtering variables. What about inputs, though? That is, those that come from $_POST or $_GET. It’s possible to use a similar strategy with a different function and different filter set.

But if you understand the basics presented in the last post, then this post will not be very different.

Continue reading

You Should Be Using PHP Filtering Functions, Part 1

I’ve talked about data sanitization in WordPress in previous posts. This is a topic that’s important not only for those of us working to build solutions for others in WordPress, but also for those who are writing code that will directly interact with a database via PHP.

Sure, there are native WordPress functions to make this process easier, but there are also built-in PHP filtering functions to help with this. Namely filter_var and filter_input and these are things that I think are helpful for PHP developers to know.

Continue reading

Search Post Metadata in the WordPress Admin Area

After you’ve worked with WordPress for any extended amount of time, it’s likely that you’ve worked with post metadata in some capacity. Perhaps you’ve simply read metadata from the database, or maybe you’ve both written to and read from the database table, as well.

It can be a really powerful API whenever you need to associate certain information with your posts (or, if you’re into abstracting things even more, to your models).

That said, what happens when you want to include information from the metadata table but don’t have the convenience of plugins such as SearchWP or Relevanssi?

Furthermore, assume the use case is just for administrators and it’s only for the administration area of WordPress. That is, you want to search your posts from within the All Posts screen but you want to include the post metadata in the search criteria, as well.

What then?

Continue reading

Modern Software Engineering in WordPress (We Were on a Break)

Over the past few years, I’ve spent a significant amount of time writing about a lot of things on how to achieve certain things in WordPress. And I don’t regret it (after all, it’s my career and it’s even the subtitle and focus of this blog).

But one of the things that I’ve opted to neglect is a focus more on topics that interest me such as object-oriented analysis, programming, design, and implementation. (And, of course, doing so within the context of WordPress.)

And sure, there are some articles where I’ve touched on it but I recently took a week off of pretty much everything except my [growing] family and during that time, I took stock of a variety of things.

One of those things included this particular site, its content, and the general focus of my career.

Continue reading
« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑