Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 187 of 428

What is WordPress kses?

Work with WordPress long enough and you’re bound to come across something called “kses” or the wp_kses function. Perhaps this comes with writing your own code, or it comes with reading someone else’s source. Or maybe in reading core.

kses

Whatever the case, the function has a weird name, right?

I mean, a lot of the WordPress API functions have clear names so it’s easy to know what you’re doing. This one is more of the exception than the rule. That doesn’t change anything, does it? I mean, it still raises the questions:

  • What’s the purpose of the function,
  • Why does it matter,
  • Why should we use it,
  • And what purpose do its variations serve?

We should be asking these questions for all functions with which we work. But when the name isn’t clear, the answers aren’t as easy to deduce.

Continue reading

Priority of Ajax in WordPress

Let’s say that you’re working with Ajax in WordPress. And let’s say that, whatever you’re building, is using object-oriented programming.

Depending on the complexity of your work, you may find that how you’ve implemented your Ajax functionality doesn’t work.

That is:

  • You’ve implemented the proper hooks
  • You’ve got the callbacks defined
  • You’re `echo`ing the data properly
  • You’ve got the `wp_die()` call at the end of each request
  • And you’ve setup `console.log()` or other debugging statements in your Development environment

But you’re still seeing the request return 0 for everything you’ve implemented.

What gives?

Continue reading

All About Freemius For WordPress

I’ve written a number of posts about WordPress plugins, their place in the overall WordPress economy, and my perspective as it relates to writing and releasing plugins.

To be sure, it’s a challenging place to be. Arguably, the most popular business model for plugins is freemium. For those who are new to this whole thing, this is basically means:

  • You offer a version of you product for free. Perhaps it’s a crippled version or it’s a version that’s designed to last for a definitive period of time.
  • You present the user with the opportunity to upgrade the plugin through the use of prompts throughout the plugin (or your mailing list) or however you’re capturing the leads.
  • This will grant all of the features and/or greater access to support, licensing, add-ons, etc. (depending on how your plugin is built) for a one time or even a subscription-based period of time.

This model works, but it’s not without it’s challenges. For example, take a look at any of the plugins in the WordPress Plugin Repository and you’re likely to find that many of them have support questions.

That is, people who are granted free software are asking for support for it. Then again, what else is to be expected?

Inherently, there’s nothing wrong with that and I’m not saying this is wrong. If you’re going to offer something for free, then expect to receive some demand for support. How much you choose to offer varies.

Regardless, many plugin authors may be a single person or may be a small number of people all of whom are trying to provide a solid product. And, generally speaking, when you offer a premium version of the plugin, only a small percentage convert.

Some people say only 1%-10% convert (though I’ve read reports where somewhere around 3% might be more correct). Regardless, it’s easy to see that going with the freemium model has its defined set of challenges.

So say you’re a WordPress plugin author, you’re looking to apply the freemium model to your business or to your product, but you want to make sure that you’re doing so with as much insight and strategy as possible.

What do you do?

Continue reading

Improved Ajax in WordPress: Object-Oriented Programming

A couple of weeks ago, I shared a post on Improved Ajax in WordPress. It provides a link to a tutorial that I wrote for Envato that shows how to incorporate Ajax into your WordPress project using procedural programming.

But not everyone who write solutions on WordPress uses procedural programming. Or you may prefer to write code using object-oriented techniques.

Whatever the case, including Ajax in WordPress is not limited to procedural programming.

To follow-up, I also wrote how to do the same thing in object-oriented programming.

Continue reading

Remove an Enqueued Stylesheet in WordPress

When working on a pre-existing version of a site, you may need to check if a style is already loaded. This, in and of itself, is not that difficult, but if it’s using an older version of a dependency, then it can get a little more complicated.

For example, let’s say that you’re building a plugin for an existing site. The existing site uses something like Font Awesome, but it’s using an older version.

Font Awesome

The requirements call for some updated icons that aren’t available in the existing version. Furthermore, the version of Font Awesome maybe be the minified version or not so we need to check for that.

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑