Here is an example of how to modify the quick links in your custom post type admin table list,
add_filter( 'post_row_actions', 'modify_list_row_actions', 10, 2 );
function modify_list_row_actions( $actions, $post ) {
// Check for your post type.
if ( $post->post_type == "my_custom_post_type" ) {
// Build your links URL.
$url = admin_url( 'admin.php?page=mycpt_page&post=' . $post->ID );
// Maybe put in some extra arguments based on the post status.
$edit_link = add_query_arg( array( 'action' => 'edit' ), $url );
// The default $actions passed has the Edit, Quick-edit and Trash links.
$trash = $actions['trash'];
/*
* You can reset the default $actions with your own array, or simply merge them
* here I want to rewrite my Edit link, remove the Quick-link, and introduce a
* new link 'Copy'
*/
$actions = array(
'edit' => sprintf( '<a href="%1$s">%2$s</a>',
esc_url( $edit_link ),
esc_html( __( 'Edit', 'contact-form-7' ) ) )
);
// You can check if the current user has some custom rights.
if ( current_user_can( 'edit_my_cpt', $post->ID ) ) {
// Include a nonce in this link
$copy_link = wp_nonce_url( add_query_arg( array( 'action' => 'copy' ), $url ), 'edit_my_cpt_nonce' );
// Add the new Copy quick link.
$actions = array_merge( $actions, array(
'copy' => sprintf( '<a href="%1$s">%2$s</a>',
esc_url( $copy_link ),
'Duplicate'
)
) );
// Re-insert thrash link preserved from the default $actions.
$actions['trash']=$trash;
}
}
return $actions;
}
Here is an example of how to modify the quick links in your custom post type admin table list,
If you are using a custom post type, and it’s hierarchical, you should instead use the filter
page_row_actions