#5: post_row_actions

The post_row_actions filter allows you to modify the row action links in the non-hierarchical post types list table. The default row actions are ‘Edit’, ‘Quick Edit’, ‘Trash’, and ‘Preview’, available when you hover over a post row in the posts list table.

It is evaluated in the single_row() method of WP_Posts_List_Table in wp-admin/includes/class-wp-posts-list-table.php.

post_row_actions only applies to list table views of non-hierarchical post types. Its sister filter, page_row_actions applies to hierarchical post types, like pages.

The filter takes two arguments:

  1. array $actions The array of row actions, the key corresponding to the span class attribute of the element
  2. object $post The post object

Example:

It seems to be more common for plugins or themes to modify post_row_actions to add additional links, so what if we remove one instead? Let’s say you wanted to remove access to the use of Quick Edit if the post type is ‘post’.

Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!

One thought on “#5: post_row_actions

  1. Week 1 Recap: Filters 1-12 – Filters of the Day

Comments are closed.