Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 187 of 219)

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

Programmatically Mark a Comment as Unapproved

In a recent project, I was working with someone who wanted to mark a comment as unapproved regardless of the value that was set in the WordPress settings.

Specifically, the person was using a plugin that allowed for certain attachments to the plugin. In order to make sure that the comment could be screened prior to allowing it to go public on the blog, they wanted to moderate it from the dashboard without needed to completely enable comment moderation across the board.

This is something that’s relatively easy to achieve programmatically.

Continue reading

Functions.php vs Plugin, Who Wins?

When it comes to introducing custom functionality into a WordPress project, the debate between functions.php vs. plugin usage is nothing new.

Generally speaking, I think of themes are presentation and plugins as functionality that transcend whatever theme or themes with which they’re installed.

But sometimes, this delineation isn’t so clear. For example, let’s say that you’re working on a theme that needs to introduce a custom meta box – or several – into the post editor screen.

Though this is presentation related in that it will impact what’s displayed to the users, it’s also a bit of custom functionality but it’s only relegated to this particular theme.

What then?

Continue reading

Don’t Copy WordPress Plugins

The conversation about the ethics of what it means to copy WordPress plugins, theme, applications, and more isn’t new. In fact, just the other day, I was having a conversation with a friend of mine about what competition looks like in various marketplaces.

Based on my conversation with him (and a number of others, for what it’s worth), there tends to be two schools of thought on releasing products into a marketplace that can be summed up in the following two statements:

  • If a similar product already exists, don’t do it.
  • If a similar product already exists, do it.

Sure, that’s an oversimplification of the idea and there’s a lot to be said about both; however, I’ve seen this same thing discussed in the context of both WordPress theme and plugin development.

Specifically, the quote I read was as follows:

1. Check the plugin repository to see if similar plugin exists.

2. If so, don’t reinvent the wheel.

Initially, I categorically disagreed with this perspective. Continue reading

A New Version of WordPress Plugin Support

I’ve written at length about the dilemma of supporting WordPress plugins and looking at various support systems both of which generated some good discussion on offering WordPress plugin support.

Over the past few months, I’ve been [slowly] mapping out exactly where I want to take the direction of the work that I do on plugins (as well as other projects), and how I want to offer support.

Last week, I took the first step and began directing all of the support requests for my current plugins into my inbox.

Continue reading

The WordPress Register Activation Hook

For those of you who have been following development of the WordPress Plugin Boilerplate, you’ll recall that I previously included the `register_activation_hook` and `register_deactivation_hook` calls within the the class itself.

In the latest version of the Boilerplate, they’ve been removed outside of the context of the class and into a separate file. Last week, I received a great comment asking why this decision was made:

I have this one question – why plugin activation/deactivation hooks are registered outside the constructor (as they were in v1.0) ?

I thought it would be better to discuss the decision in a blog post rather than in a lengthy comment.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑