1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. Advanced Usage

How to link from the table to the 'Edit post' page

In Posts Table Pro, the title of each post (or custom post) in the table normally links to the single post page in the front end. This article contains a code snippet which will allow you to link it to the 'Edit post' screen in the WordPress admin instead. For example, you may wish to do this if you are using Posts Table Pro for internal purposes and the table will only be viewed by logged in administrators.

First, make sure that there is no title column in your list of table links. That's because the code snippet will add a link to the title column for you programmatically.

Step 2. Add the code snippet

Add the following code snippet to the functions.php file of your child theme, or using the free Code Snippets plugin. If you don't know how to do this then you should ask your developer, or post a job on Codeable to get a quote.

add_filter( 'posts_table_data_title', function( $title, $post ) {
// Change the link to the post edit page
return '<a href="'. get_edit_post_link( $post ) .'">'. $title .'</a>';
}, 20, 2 );
We've partnered with Codeable to provide our customers with expert help if required.

The code snippet uses the posts_table_data_<column> filter which you can read about in the developer documentation:

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.