I’m working on a plugin, which converts a site into a feedback sort of portal. I made a new object page, ‘Feedbacks’, which displays all the feedbacks is a tabular format, and I’m using register_column_headers($array_of_column_headers) to make my table. I wanted to know if it is possible to add my own page row actions to this table, i mean under every feedback in the list, actions like ‘approve’, ‘delete’, ‘blacklist’ etc.

I read the code and a couple of tickets, and found out its done this way: for posts, its post_row_actions, for comments its comment_row_actions, for media its media_row_actions and so on. Is there a filter that allows me to do, my-page-slug_row_actions?

1

When using custom post type you use the post_row_actions filter hook and check the post type to modify it only:

add_filter('post_row_actions','my_action_row', 10, 2);

function my_action_row($actions, $post){
    //check for your post type
    if ($post->post_type =="feedbacks"){
        /*do you stuff here
        you can unset to remove actions
        and to add actions ex:
        $actions['in_google'] = '<a href="http://www.google.com/?q='.get_permalink($post->ID).'">check if indexed</a>';
        */
    }
    return $actions;
}

Quick update:

thanks to somatic
if you custom post type is “hierarchical” then you action hook is:
page_row_actions.

Leave a Reply

Your email address will not be published. Required fields are marked *