Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 84 of 258)

Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

Using Xdebug with Valet and WordPress

Though I’m not a fan of strictly using var_dump or echo statements as a way to debug code, that doesn’t mean there aren’t times in which they are useful (otherwise, they wouldn’t be part of the language, right?).

But what if you’re using Laravel Valet (which is easy enough to setup for WordPress) and you’re trying to display some multidimensional array and rather than getting some nicely formatted output, you end up getting one long line of text in Times New Roman? Odds are this is because you don’t have Xdebug.

Using Xdebug with Valet and WordPress: Valet

It’s easy enough to do, but it’s predicated on a few different things. Plus, once you get Xdebug installed, then you’re able to use a debugger with your code, as well. That’s not the point of this post, though.

Continue reading

On Improving Content Across the Board

When I last published, it was all about taking a break from social media and why I think it’s useful.

But I ended up not only doing that. Instead, I also took a break from writing (which save for a recent trip is not something I usually do). When you end up taking that kind of time off from writing, you can’t help but build up a backlog of ideas for content that will eventually find its way to be published.

Before getting back into the usual routine, I thought it worth sharing some upcoming plans I have for the site that will impact those of you who read regularly and those of you who may be new readers or who are just stumbling across this post.

Continue reading

Social Media Breaks Are Good for the Soul (I Think)

Not too long ago, I took a break from social media for two reasons (one no more important than the other):

  1. to try to break the habit of compulsively checking social networks whenever I was stuck on a problem,
  2. to cut back on “chatter” during the day.

(I looked through my previous posts to see if I talked about it at length but couldn’t find it.)

https://twitter.com/tommcfarlin/status/880912831922753536

Anyway, it’s something I’ve decided to do again, although this time I have a few different reasons. Maybe it’s social media breaks are something I’ll do a more on the regular, maybe not. I can’t know that right now.

We’ll see in a month.

Nonetheless, this time I thought it worth sharing a little bit more behind the reasons why if for no other reason to make sure I have it documented more so than I did last time.

Continue reading

Adding Your WordPress Plugin To Packagist

When you start adding your WordPress plugins to GitHub, one of the next things you’re likely going to want to do is make it easy for other developers to begin incorporating those packages into their composer.json file.

That is, they don’t have to download your plugin, include it in your project, watch for updates, or anything like that. Instead, they add the file then run:

$ composer update

…whenever they are ready to get the latest version of your work.

But simply contributing your work to GitHub is not enough. You have to submit your WordPress plugin to Packagist (of course, this works with other projects, too, but that’s outside the scope of this blog, really).

And here’s how to do it.

Continue reading

WordPress Queries with IN Clauses (Who Knew)?

A little over a year ago, I wrote a post on how to use WP_Meta_Query whenever you have a set of keys you want to use to help pull back information from the database.

What about the case, though, when you have a number of different keys that would result in creating a really long array for the WP_Meta_Query class? For example, what if you had to loop through a collection of data before even setting up the query?

On some level, it might feel that like the natural thing to do would be to:

  1. iterate through the collection of keys,
  2. dynamically build up the results,
  3. combine them into a single result set,
  4. then work with whatever you’re given.

But doesn’t that sound a bit cumbersome (let alone slow)?

When it comes to using the WordPress API, I do what I can to stick to it before talking, say, directly to the database but there are also times where it makes sense to write a raw query than to write some type of clever code just to get the WordPress API to work. Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑