Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 63 of 219)

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

WordPress Plugin Interfaces: Working With Assets

One of the advantages of working with object-oriented programming is the ability to define interfaces so classes that implement those interfaces have a strict set of functions that said classes must implement.

WordPress Plugin Interfaces

That is the definition of a class interface, anyway:

An interface is a contract specifying a set of methods, fields and properties which will be available on any implementing object

But how might this look if we’re aiming to create a namespaced solution for including WordPress plugin interfaces (or an interface) for a class that can be used to enqueue stylesheets or JavaScript files?

Continue reading

Globally Installing WP-CLI for Access Across Your System

When working on WordPress-based projects that utilize Composer, there are times that we’re going to want to have certain dependencies available for our project and there are times where we’re going to want to have tools available throughout our system.

For example, for some projects, we may want to have PHP CodeSniffer with the WordPress Coding Standards available. For others, maybe not.

But having a tool like WP-CLI is something that’s likely better served when it’s available throughout the entire system rather than on a project-by-project basis. Globally installing WP-CLI is a relatively trivial matter.

It does, though, assume you have Composer already installed and available on your system.

Continue reading

Properly Filtering Post Content (And Understanding apply_filters)

Now and then, whenever I’m working with pre-existing source code or performing a code audit, I’ll see others modifying the post content of a post object like this:

At this point, some will drop in and immediately say you’re doing it wrong. I hate that phrase (and it’s even littered throughout the WordPress codebase, but I digress).

There are ways to use other existing WordPress API functions to sanitize the data before setting it equal to the value of the post_content attribute, using those functions isn’t the best way to go about doing it.

Instead, we all should be using apply_filters. The problem? Some don’t know, some don’t know how it works, and some don’t know how to use it. That is it’s not clear how to go about properly filtering post content.

Properly Filtering Post Content

Raw content filtered by WordPress then written to the database.

But for those who may fall into any of the categories above, then perhaps this can help.

Continue reading

What Does It Mean to Use WordPress as a Proxy?

If you’ve worked with WordPress for any length of time especially when it comes to using some type of Ajax functionality, then you’ve likely heard the phrase “use WordPress as a proxy” at some point.

And even if you haven’t the odds that you’ve actually done it are pretty high.

Though I think that, as time moves forward, we’re going to eventually see the REST API replace the traditional ways that we’ve used Ajax but that’s likely a different story for another time.

So what does it mean to use WordPress as a proxy whenever you’re working with Ajax requests? It requires a little bit of understanding cross-site requests, how routing a request through WordPress works, and then parsing the response.

Continue reading

WordPress Project Milestones: Scoping Them For Clients

Up until the last year, one of the ways that I’ve scoped milestones is based heavily on the perspective of how I or my team and I were to be working the project.

There’s a problem with this approach, though: For those of us who try to include client feedback throughout the development process, it’s not as easy for them to take the jargon we use and still have them make sense of it.

To that end, I’ve started scoping WordPress project milestones a little bit differently so they are a bit more customer-friendly all the while still making sense to how a team of developers can accomplish what’s necessary to make sure things are functionality.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑