Bearbeiten Sie die “Post aktualisiert. Beitrag anzeigen “Link

Ist es möglich, den Link “Beitrag aktualisiert. Beitrag anzeigen” zu bearbeiten und den “Beitrag anzeigen” vollständig zu entfernen? Ändern Sie auch die “Post” auf den Namen eines cpt?

Danke Leute!

Aktualisieren:

Hier ist der Code, den ich benutzt habe und es hat wie ein Zauber funktioniert. Ich hoffe, das hilft anderen!

In meinem Beispiel verwende ich “Kontakt” als mein cpt:

Bildbeschreibung hier eingeben

 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. View Contact'), esc_url( get_permalink($post_ID) ) ), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => __('Contact updated.'), /* translators: https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s: date and time of the revision */ 5 => isset($_GET['revision']) ? sprintf( __('Contact restored to revision from https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __('Contact published. View Contact'), esc_url( get_permalink($post_ID) ) ), 7 => __('Contact saved.'), 8 => sprintf( __('Contact submitted. Preview Contact'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 9 => sprintf( __('Contact scheduled for: %1$s. Preview Contact'), // 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. Preview Contact'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), ); return $messages; } 

Solutions Collecting From Web of "Bearbeiten Sie die “Post aktualisiert. Beitrag anzeigen “Link"

Sie können die Update-Nachrichten filtern: add_filter('post_updated_messages', 'your_message_function');

Schauen Sie in /wp-admin/edit-form-advanced.php nach, wo die Standardnachrichten eingestellt sind.

Um dies für alle CPTs zu tun, habe ich einen core gefunden, der es in eine einfache function abstrahiert, um die functions.php zu löschen

https://gist.github.com/benklocek/2b510994c3ecbe508af6

 /** * Replaces "Post" in the update messages for custom post types on the "Edit"post screen. * For example, for a "Product" custom post type, "Post updated. View Post." becomes "Product updated. View Product". * * @param array $messages The default WordPress messages. */ function pico_custom_update_messages( $messages ) { global $post, $post_ID; $post_types = get_post_types( array( 'show_ui' => true, '_builtin' => false ), 'objects' ); foreach( $post_types as $post_type => $post_object ) { $messages[$post_type] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s updated. View https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s' ), $post_object->labels->singular_name, esc_url( get_permalink( $post_ID ) ), $post_object->labels->singular_name ), 2 => __( 'Custom field updated.' ), 3 => __( 'Custom field deleted.' ), 4 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s updated.' ), $post_object->labels->singular_name ), 5 => isset( $_GET['revision']) ? sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s restored to revision from https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s' ), $post_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s published. View https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s' ), $post_object->labels->singular_name, esc_url( get_permalink( $post_ID ) ), $post_object->labels->singular_name ), 7 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s saved.' ), $post_object->labels->singular_name ), 8 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s submitted. Preview https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s'), $post_object->labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $post_object->labels->singular_name ), 9 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s scheduled for: %1$s. Preview https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s'), $post_object->labels->singular_name, date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $post_object->labels->singular_name ), 10 => sprintf( __( 'https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s draft updated. Preview https://wordpress.stackexchange.com/questions/15357/edit-the-post-updated-view-post-link/%s'), $post_object->labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $post_object->labels->singular_name ), ); } return $messages; } add_filter( 'post_updated_messages', 'pico_custom_update_messages' ); 

Hinweis: Die functionsnamen in der add_filter Methode und die tatsächliche functionsdefinition unterscheiden sich voneinander im core. Dies wurde im oben gezeigten eingefügten Snippet korrigiert.