I have custom post type called messages where I will store emails and my request is very specific. New post cannot be created and user cannot do anything with it except delete it. I have already added a custom post row action for viewing messages, but I want to view them in a custom screen where only the ID of the post will be passed in request.
add_filter('post_row_actions', function ($actions, $post) {
if ($post->post_type === 'message') {
unset($actions['edit']);
unset($actions['inline hide-if-no-js']);
$actions['view'] = '<a href="'.admin_url().'edit.php?post='.$post->ID.'&action=view_message" rel="bookmark">View</a>';
}
return $actions;
}, 10, 2);
As u can see I want the action=view_message
to be my trigger.
UPDATE:
Here is a snippet from another theme I developed:
/**
* Add sub menu page to the custom post type
*/
function add_submenu_page_to_post_type()
{
add_submenu_page(
'edit.php?post_type=newsletter',
__('Newsletter SendMail', 'simplebyte'),
__('SendMail', 'simplebyte'),
'manage_options',
'sendmail',
'newsletter_sendmail_options_display'
);
}
/**
* Options page callback
*/
function newsletter_sendmail_options_display()
{
echo 'something';
}
Here's the a custom screen accessible as a submenu page in the cpt. Instead I want a screen like that, not visible, and to be able to pass it the post ID.