Plugin Dev: Best practices to add actions to Edit Posts list
-
Hi,
I’m writing a plugin that hooks into the ‘Edit Posts’ view (the view that lists the most recent posts in the Admin panel). In short, the plugin allows the admin to flags which posts appear on the frontpage, and which will appear in the regular list of “Recent Posts.” I understand that there a workarounds with this (putting the posts in a certain category and telling WP to show posts in that category). That workaround is not acceptable to the client as authors can select a category when submitting a post.
I’ve used the hooks ‘manage_posts_columns’ and ‘manage_posts_custom_column,’ and I’ve gotten my custom columns to appear in the list (yay).
But I need to do more than just display data. I need to add buttons/links for the admin flag any post as “Display on Frontpage.” I have a database schema already in place.
My question is: What is the standard or best practice for this? Should I just echo out links in here?
function my_manage_posts_custom_columns($column_name, $id) { echo '<a href="flag.php">Flag me!</a>'; }
Is there an API function I can call instead of just echoing HTML links?
If I do it via AJAX, how do I implement a fallback function (in case the AJAX call fails) through a plugin?
- The topic ‘Plugin Dev: Best practices to add actions to Edit Posts list’ is closed to new replies.