Advertisement
fahimmurshed

Add "Edit in New Tab" option on the Posts

Oct 1st, 2023
946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. add_filter( 'post_row_actions', 'tab_row_actions', 10, 2 );
  2. function tab_row_actions( $actions, $post )
  3. {
  4.     if( get_post_type() === 'post' )
  5.     {
  6.         $edit_tag = "<a target='_blank' href='";
  7.         $link = admin_url( 'post.php' );
  8.         $edit_tag .= add_query_arg(array('post' => $post->ID, 'action' => 'edit'), $link);
  9.         $edit_tag .= "'>Edit in New Tab</a>";
  10.         $actions['edit_new_tab'] = $edit_tag;
  11.     }
  12.     return $actions;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement