I want to describe how the Comment Redirector Plugin used the Post Quick Edit Form because it has a number of moving parts. I’ll describe adding a column to the WordPress Administration Post List here, then follow with the Post Quick Edit Form. The source code is available on the WordPress Plugin Download Page.
First I’ll answer why we’re using the Post Quick Edit Form in the Comment Redirector Plugin. Here’s a screenshot showing our Comment Redirection Url property. I wanted to use the Quick Edit Form because it was, well, quicker to add the url. I am also using the Quick Edit Form because the url is added after the post is published, making it easier to enter it on the display all posts page.
A Graphic Header Sidebar
To customize the Post Quick Edit form you need to add a custom column. That’s just the way it is, so the checkboxes at the far right in the above screenshot indicating whether or not the Comment Redirection Url was entered for the post worked out great for my needs.
Why is a custom column required? Because to add logic to the Quick Edit form you need to test for the new column.
As I said, the checkbox worked out great for the Comment Redirector because it served multiple functions and took up very little real estate. Since I was taking up only a checkbox of space in the column I wanted a checkbox-sized header, so I created a graphic to indicate Comment Redirection.
Here’s the graphic header logic. We’re looking for the Post List page and when we’re on it, load the CSS below. The arrow indicates where the header graphic background is set.
We need some content in the header so we’ll add it in the manage_post_posts_columns filter function.
And finally, the checkbox to indicate whether the Comment Redirection Url of the post has been entered. First the checkboxes (again) and below, the logic of setting the checked property.
We’ll end the first part on the Post Quick Edit Form here and will move next to the form itself, among other things describing how to use Ajax to populate our custom field.