Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 100 of 428)

Download User Email Addresses via JSON in WordPress, Part 1

Say you’re working on a project in which you want to provide the user the ability to download all of the email addresses from the users that exist in the WordPress installation. Granted, this has a few requirements:

  • You only want administrators to do it,
  • It needs to be secure via nonce values,
  • The responses should be in JSON,
  • And you want to use JavaScript to send the file when it’s ready to download.

Each of the above concepts has likely been covered here before, but what if you’re looking to tie them all together? That is, what if you want to make it easy to download user email addresses via JSON within WordPress from, say, an administration menu or a submenu?

Download User Email Addresses via JSON in WordPress

An obligatory shot of where I’m working while writing this post.

Here’s one way to tackle that problem. Note that it does assume you have some knowledge of the above, but I’ll do what I can to cover each of the above.

Continue reading

For Quality, It’s Understanding Before Coding

Whenever you aim to blog about a series of different things all seeking to help out people write quality code (or write anything, really) to help improve their workflow, you’re bound to get feedback, right?

Don’t get me wrong. I welcome it. I think it helps to make for better writing in the future (that is, I ask, what can I do better).

And at the risk of looking like I’m “calling someone out” (which I am not), I want to share an [unattributed] tweet that I received last week:

your title “high-quality code” got me pumped for some hardcore stuffs, but dude ~99% narrative vs ~1% code?? *drops dead on his keyboard*

And I get it. There’s very little code in a post that is aiming to talk about code. But there are reasons for this, and it comes from a few years of both reading articles, writing articles, reading code, and writing code.

So I thought for others who have the same thoughts, it might be worth explaining why I take the approach I do.

Continue reading

WordPress Data Collection with EZ Data

Usually, whenever I share resources on this site, it’s for development-related tools. Sometimes it’s plugins, other times; it’s things that we may use that are tangentially related to our work.

Sometimes, I’ll publish things from peers in the industry who I don’t know; other times; it’s from people who I know, consider a friend, and respect.

And the latter is the case with Roy Sivan and EZ Data.

Continue reading

How to Use PSR-4 Autoloading WordPress Plugins

Say that you’re working on a project for someone and you’ve scoped it out, tasks are delegated, you have all the libraries and tools you need to get started, and you’ve separated what will be the theme or presentation, and what will be the functionality or the plugins.

But rather than having a handful of individual plugins, what if there was a package of smaller functional plugins or micro-plugins or whatever you want to call them working to power the package?

PSR-4 Autoloading WordPress Plugins: Example Organization

Furthermore, these all of which are built on the same foundation but that also share code with one another and to make things more interesting, you opt to use a PSR-4 autoloader via Composer to take care of all of this?

Continue reading

Configuring Composer for WordPress, Part 2

In this post, I’ll wrap up what I began to share yesterday: Using the tools and libraries I’ve shared in conjunction with Composer to sniff your commits during development before the code hits the repository.

Ideally, you’re always going to want to see something like this in your terminal whenever you commit your code:

Composer for WordPress, Part 2: Configuring Sniffs

But that’s not always the case. As with most things, though, the more you practice, the more you’ll get used to writing code that will automatically pass the various sniffs put in place through the different rules (and their customizations).

Before doing that, though, you’ve got to get GrumPHP configured in your repository.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑