Software Engineering in WordPress, PHP, and Backend Development

Category: Notes (Page 32 of 49)

Notes on programming-related problems that I’ve encountered while working on various projects.

The Dangers of Using pre_get_posts in WordPress

In the previous post, I talked a bit about using `pre_get_posts` and how to efficiently exclude categories from the main loop.

Of course, in posts like that, the code is meant to be a point of reference or a starting place for which more advanced functionality can be written.

But one thing that I failed to mention about using `pre_get_posts` in WordPress is that it’s not limited to the public facing side of the site.

Continue reading

How To Efficiently Exclude Categories From The WordPress Loop

When it comes to writing custom queries in WordPress, `WP_Query` is the API to use. And I could be mistaken, but I do see a lot of people urging developers to avoiding using `query_posts` in WordPress in favor this newer-ish API.

But the thing is that `query_posts` still has its place in WordPress development namely in modifying the results of the data queried for The Loop when rendering blog content; however, one of the the biggest caveats is the performance that `query_posts` can have on the performance of the blog.

I’ve recently been working on a plugin where I needed to exclude posts from The Loop based on the category. At first, I was going to use `query_posts` but I ultimately hit a few snags, so here’s an alternative way to exclude categories from the WordPress Loop.

Continue reading

Properly Setting Up WordPress Cron Jobs

As it relates to scheduling events in WordPress, there’s a lot of articles that already exist on setting up a WordPress cron job, but – and for what I believe to be a number of reasons – there’s a surprising lack of clarity around the topic.

Of course, I could be wrong – maybe I’ve just been looking in all of the wrong places.

Whatever the case may be, this is something that I’ve been dealing with in a couple of projects, and I thought I’d capture my notes here if, for no other reason, than to reference in the future.

Continue reading

Teasing Pressware

For sometime now, I’ve been talking about refocusing all of my efforts to be solely on WordPress-related projects, speaking events, writing, and so on.

Considering that I’ve covered which support solution I’ve ended going with, and that I just released my first premium plugin in a couple of years, I thought it might be time to actually put up a simple teaser landing page for my upcoming rebrand.

Continue reading

How To Programmatically Send Email in WordPress

Late last year, I shared a post in which I provided some steps on how to change the email sender in WordPress. Specifically, the post provides the steps necessary to change the name and the address from which the email is sent.

You can read the post in its entirety here – and it’s a quick read – but the short if it is that it uses the following filters:

The thing is, I never actually shared how to programmatically send email in WordPress. Though there’s a specific function for doing this, it can get a little more complicated if you’re writing an advanced feature of a theme, plugin, or an application.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑