Comment Redirector WordPress Plugin Tech Overview

I described my Comment Redirector WordPress Plugin last time and why I created it. Now for a quick structure and layout overview before getting into any technical particulars.

Comment Redirector File Structure

Starting at the top, assets are used on the Plugin Listing on  Css contain the stylesheets for both the Comment Redirector admin contents and the Comment Redirection message on the blog post. Images, self explanatory. Include contains support functions to populate the Post Quick Edit form (which requires client-side data retrieval, typically using ajax.) Views contains the admin form for customizing the Comment Redirection message template. The main Comment_Redirector Class is located in the root comment-redirector.php.

Actions and Filters

Here’s a quick summary of the plugin’s actions and filters.

We add a menu item and some CSS to load on the admin Post List page in the first two actions. We add a load styles action (which should probably have been named _enqueue_STYLES instead of _enqueue_SCRIPTS. The next group-of-four actions handle 1) an admin post list checkbox column we added that shows whether or not the post was assigned a Comment Redirection Url, 2) the quick edit form addition of our Comment Redirection Url textbox in quick_edit_custom_box, 3) save_post, self-explanatory, and 4) a function to load the javascript to populate the quick edit form in admin_head-edit.php. The two filters at bottom 1) append the Comment Redirection message to the post with the_content filter and 2) add our new column header on the admin post list.

Perhaps the most interesting aspect of the plugin from a developer’s perspective was adding a field to the Post List Quick Edit Form and what that entailed. I’ll post on that next.