0

How would I make Post published. View post(edit and pages as well) always open in a new tab? I have this in an iframe but it looks weird when a post is in it.

0

Open WP-Admin Editing File:

  • Open the file located at: /example.com/public_html/wp-admin/edit-form-advanced.php

Edit: Edit these lines to look like the next, adding target=”_blank” to each link or pasting the whole list.

$messages = array();

$messages['post'] = array(

0 => '', // Unused. Messages start at index 1.

1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),

2 => __('Custom field updated.'),

3 => __('Custom field deleted.'),

4 => __('Post updated.'),

/* translators: %s: date and time of the revision */

5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,

6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),

7 => __('Post saved.'),

8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),

9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</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( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),

);

$messages['page'] = 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) ) ) ),

(Use these)

$messages = array();

$messages['post'] = array(

0 => '', // Unused. Messages start at index 1.

1 => sprintf( __('Post updated. <a href="%s" target="_blank">View post</a>'), esc_url( get_permalink($post_ID) ) ),

2 => __('Custom field updated.'),

3 => __('Custom field deleted.'),

4 => __('Post updated.'),

/* translators: %s: date and time of the revision */

5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,

6 => sprintf( __('Post published. <a href="%s" target="_blank">View post</a>'), esc_url( get_permalink($post_ID) ) ),

7 => __('Post saved.'),

8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),

9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</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( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),

);

$messages['page'] = 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) ) ) ),

);

Source: CodeBucket.io

1
  • Jip, restrictions, forgot about that :-) Jan 3 '15 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy