How do I add a custom screen for a custom post type to be called from custom post row action?

Question

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.

0
, , Amir Rami 2 years 2019-10-22T12:21:05-05:00 0 Answers 86 views 0

Leave an answer

Browse
Browse