post_row_actions for custom post type

As @bonger commented, there is no custom post type filter despite what you’ve read.

To use this filter for a specific post type, the best way is to use the post_row_actions filter and then test against the passed in $post->post_type.

I’ve used the code below to add links to the actions row for a specific post type (in this case, myposttype).

This will need to be edited to work for your own post type, and obviously for the new link to actually do anything more code is needed, but this is the idea:

function my_duplicate_post_link($actions, $post)
{
    if ($post->post_type=='myposttype')
    {
        $actions['duplicate'] = '<a href="#" title="" rel="permalink">Duplicate</a>';
    }
    return $actions;
}
add_filter('post_row_actions', 'my_duplicate_post_link', 10, 2);

Leave a Comment