WordPress Snippet
Last active
October 2, 2016 20:20
-
-
Save ControlledChaos/a423e9a7f21130efc103 to your computer and use it in GitHub Desktop.
Modify editor messages for custom post types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ccd_cpt_updated_messages( $messages ) { | |
$messages['custom_post_type'] = array( | |
0 => '', // Unused. Messages start at index 1. | |
1 => sprintf( __( 'CPT updated. <a href="%s">View CPT</a>' ), esc_url( get_permalink( $post_ID ) ) ), | |
2 => __( 'Custom field updated.' ), | |
3 => __( 'Custom field deleted.' ), | |
4 => __( 'CPT updated.' ), | |
/* translators: %s: date and time of the revision */ | |
5 => isset($_GET['revision']) ? sprintf( __( 'CPT restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, | |
6 => sprintf( __( 'CPT published. <a href="%s">View CPT</a>' ), esc_url( get_permalink( $post_ID ) ) ), | |
7 => __('CPT saved.'), | |
8 => sprintf( __( 'CPT submitted. <a target="_blank" href="%s">Preview CPT</a>' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), | |
9 => sprintf( __( 'CPT scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview CPT</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( __( 'CPT draft updated. <a target="_blank" href="%s">Preview CPT</a>' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), | |
); | |
} | |
add_filter( 'post_updated_messages', 'ccd_cpt_updated_messages' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment