Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 71 of 219)

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

Xdebug, Visual Studio Code, and MAMP

Using Xdebug and Visual Studio Code is something that’s pretty easy to setup, but given that I’m still using Visual Studio Code should tell you something about how much I’m a fan of the IDE.

But here’s the thing:

If you’re a WordPress developer, debugging is something that you really need to learn. That is, don’t use print_r and var_dump if you can help it. Use a legitimate debugger. It will help you think as the interpreter thinks and it will help you learn a bit more about Core.

Now that I’m off my soapbox, getting the necessary tools installed is easy. The article assumes you’re using MAMP Pro (since that’s what I use), but if you have access to php.ini then you’re going to be able to follow along.

Continue reading

Using a WordPress Hook for Updating Options

Updating options within the WordPress admin is simple, right? It’s a matter of filling out a text field, checking a box, or swapping a radio button then clicking save.

But let’s say that you need to set up a hook that fires that also updates a secondary, related option whenever one is toggled.

Updating Options Hook

For example, given an option represented by a checkbox, let’s say that you want to set an option in the database whenever the checkbox is unchecked and then delete it whenever said option is set.

There’s an action specifically for doing this that makes it pretty easy.

Continue reading

Remote Requests with wp_safe_remote_get

Yesterday, I shared a post on how to use wp_remote_get but I left out an alternative function: wp_safe_remote_get. The original goal was to use the first post to show:

  1. What the original function accepts,
  2. How to use the original function,
  3. What the original function returns,
  4. What an implementation make look like.

And then I was going to take a look at wp_safe_remote_get. But there’s a challenge: I have smart friends. Shortly after I published the post, I get a response from Roy:

Thanks, Roy! (Be sure to say “Hi!” to him. :)

But seriously, the follow-up to yesterday’s post is exactly that: wp_safe_remote_get. And it’s how to determine the difference in the two functions and when you’d use one over the other.

Continue reading

Remote Requests with wp_remote_get

If you’re read any of my previous posts on retrieving remote files, then you know that old habits die hard as I often use file_get_contents rather than wp_remote_get.

So, as one does when blogging, I thought it would be helpful to share a simple example of how to use wp_remote_get in your day-to-day work.

wp_remote_get in the WordPress Developer Resources

The post below is merely a snippet of how to use it. That is, it won’t show how to designed, say, a class around it or a UI that allows users to upload a file. But this should be enough to get things started.

And I’ll include how to take the API documentation around it and understand how to leverage it when using a function like this.

Continue reading

WordPress Plugins Are Adopted: Thank You!

A couple of days ago, I shared that I was looking to put some of my plugins up for adoption. I’ll go into a bit more details as to why later in this post, but I’m happy to say the WordPress plugins are adopted.

It’s funny to talk about little side projects as if they are your pets – then again, we do have the phrase “pet projects” so I suppose it makes sense in this context. ‍♂️

At any rate, as I said, they’ve all been adopted, and I couldn’t be more excited as to where they are going. Though it would have been fine for each one to go to a different developer, they’re all going to fall under Philip Arthur Moore’s ownership.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑