Edit the “Post updated. View post” link

Is it possible to edit the “Post updated. View post” link and remove the “View post” entirely? Also change the “Post” to the name of a cpt?

Thanks guys!

Update:

Here is the code I used and it worked like a charm. I hope this helps others!

In my example I use “Contact” as my cpt:

enter image description here

add_filter('post_updated_messages', 'contact_updated_messages');
function contact_updated_messages( $messages ) {

$messages['contact'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( __('Contact updated. <a href="https://wordpress.stackexchange.com/questions/15357/%s">View Contact</a>'), esc_url( get_permalink($post_ID) ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Contact updated.'),
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( __('Contact restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __('Contact published. <a href="https://wordpress.stackexchange.com/questions/15357/%s">View Contact</a>'), esc_url( get_permalink($post_ID) ) ),
7 => __('Contact saved.'),
8 => sprintf( __('Contact submitted. <a target="_blank" href="https://wordpress.stackexchange.com/questions/15357/%s">Preview Contact</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( __('Contact scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Contact</a>'),
  // translators: Publish box date format, see http://php.net/date
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( __('Contact draft updated. <a target="_blank" href="https://wordpress.stackexchange.com/questions/15357/%s">Preview Contact</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
);

return $messages;
}

2 Answers
2

You can filter the update messages: add_filter('post_updated_messages', 'your_message_function');

look in /wp-admin/edit-form-advanced.php to see the where the default messages are set.

Leave a Comment