Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 288 of 429)

Programmatically Delete Files in WordPress (and Their Associated Meta Data)

This is post two of two on how to upload files in WordPress and created associated meta data. Read the first post here.

In the first post in this series, I mentioned that I’ve been working on a plugin in which the users needs to upload a file to a custom post type without the use of the Media Uploader.

This is basically done via use of an `input` type of `file`, WordPress `nonce` values, and some basic PHP functionality, but if you’d like to read more, then be sure to review the first post.

As mention in the first article, the second part of being able to store files and their associated meta data is so that you can also remove the files (and the meta data) when the user triggers the appropriate action.

Specifically, the plugin must do the following:

  1. Verify the request’s incoming `nonce` value
  2. Use (or somehow retrieve) the specified meta key for the file to be deleted
  3. Delete the file from the file system
  4. Remove the database entries – that is, the meta data – associated with the file

Just as in the last article, we’ll take a look at each step and the code required for each, as well.

Continue reading

Strategies To Future Proof WordPress

Future Proof WordPress

You’ve gotta be prepared for the future, just in case you end up there.

For those of you who have read this blog long enough, you know that I’m a big advocate for using WordPress for web application development.

No, I don’t think it’s the end all, be all of foundations for web applications, but it’s one that shouldn’t be overlooked depending on the nature of your requirements.

Anyway, a friend of mine recently contacted me asking what I do to future proof WordPress when I begin to use it build applications on top of it. Specifically, he asked what steps I take when working on projects that may end up breaking with the next WordPress upgrade.

Since I don’t recall ever sharing the steps and tools that I use, thought it would be good to cover here.

Note that these aren’t all the things that I do or that can be done (and I’m sure you guys have some great suggestions, too), but these are the things that came to mind that I’ve found to be absolutely critical.

Continue reading

A Simple Helper to Check if a Post Has Comments or Pingbacks

A previous post, I shared a strategy on how to separate comments, trackbacks, and pings in a WordPress post.

In short, the article covered how to create a template such that the comments would be listed first, then the trackbacks and pings would be listed second.

In addition to creating templates that separate the types of comments related to a post, I also find it useful to have a helper function to determine if a given post has comments and/or pingbacks.

Continue reading

The Challenges of Monetizing Open Source Software: Contributors

The very idea of monetizing open source software – especially projects that have a list of contributors – is something that I spend more time thinking about than I’d like to admit.

One of the many Dev Practices

One of the many Dev Practices

And I bring this up because there are a number of things that I’m working on (and that I’ve seen my peers work on), that are directly impacted by this.

As with anything, I’ve my own opinions about this, but I’m curious as to what you guys think as it relates to monetizing open source software.

Continue reading

Why I Don’t Update Old Blog Posts with a New Theme

Update Old Blog Posts

For those who actually read this blog in a browser (rather than in a feed reader), you know that I’ve been using a new theme for the past few weeks.

Whenever you – or someone else – changes themes, it raises the question as to if you should go back over your old content and update your old blog posts so that they look well-formatted within the context of the new presentation.

If your blog is in its infancy and/or only has a few dozen posts, I think that makes sense, but if you’ve been writing for a while and have, say, several hundred posts or several years worth of posts, I don’t think it’s worth it.

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑