This is a great question because I think it really matters when you want to provide a great experience for your end user.
For the first requirement, changing the button text “View Post” to something else is pretty easy. When you’re registering your post type you can (and should!) provide a set of labels. The defaults can be found in the function get_post_type_labels
(in /wp-includes/post.php
). To change the “View Post” button text, simply provide the text you want as the view_item
key of the labels array.
For the second requirement, this is something I see very, very few people doing right but it is so simple. Simply hook a callback to the post_updated_messages
filter and append an array as follows:
function custom_post_type_post_updated_messages($messages) {
$messages['custom_post_type_key'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Page updated.'),
5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
7 => __('Page saved.'),
8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
);
return $messages;
}
To see where this happens, open up /wp-admin/edit-form-advanced.php
and look at the code from lines 38-77 (in WP 3.8.1). Let me know if you have any questions!