Personally, I would keep that link (despite the page has other links/ways for accessing the post).
But if you must, you can remove that “View post” link, or change the entire message, using the post_updated_messages
hook. E.g.
add_filter( 'post_updated_messages', 'my_post_updated_messages' );
function my_post_updated_messages( $messages ) {
// Note the array index, which is 6 for the "post published" message.
$messages['post'][6] = 'Post published.';
return $messages;
}
The above is for the post
post type, but is also used as the default for other post types, if $messages['<post type>'][<message number>]
is not set. So if you want to target a specific post type other than post
, then you can copy the $messages['post']
or $messages['page']
, and change only the messages that you wish to change. Example for a post type named news
:
add_filter( 'post_updated_messages', 'my_news_updated_messages' );
function my_news_updated_messages( $messages ) {
$messages['news'] = $messages['post']; // copy the entire messages for 'post'
$messages['news'][6] = 'Post published.';
return $messages;
}
And for WordPress v6.0.1, you can see the default messages here.