Adding a link in post-type list

484 views Asked by At

I want to add a custom link in the posts of my post-type with the filter post_row_actions but there's no additional link.

I use this code :

function custom_duplicate_link( $actions, $post ) {
    $actions['duplicate'] = '<a href="admin.php?action=custom_duplicate_post_as_draft&amp;post=' . $post->ID . '" title="Duplicate" rel="permalink">Duplicate</a>';
    return $actions;
}
add_filter( 'post_row_actions', 'custom_duplicate_link', 10, 2 );

Have I missed anything? Or does anyone know why it isn't working?

1

There are 1 answers

1
Queli Coto On

Check your custom post type:

'hierarchical' => TRUE,

  1. The filter 'post_row_actions' only work with post types not hierarchical.
  2. The filter 'page_row_actions' only work with post types hierarchical.