# Open "View" and "Preview" Row Links in a New Tab

> Makes the View and Preview links under each post and page in admin lists open in a new browser tab.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin, list-table, links
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/row-action-view-new-tab/

## Code

```php
$wpide_row_links_new_tab = function ( $actions ) {
    foreach ( array( 'view', 'preview' ) as $key ) {
        if ( isset( $actions[ $key ] ) && false === strpos( $actions[ $key ], 'target=' ) ) {
            $actions[ $key ] = preg_replace( '/<a /', '<a target="_blank" rel="noopener" ', $actions[ $key ], 1 );
        }
    }

    return $actions;
};

add_filter( 'post_row_actions', $wpide_row_links_new_tab );
add_filter( 'page_row_actions', $wpide_row_links_new_tab );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Open "View" and "Preview" Row Links in a New Tab" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
