page_row_actions
Allows you to change the list of page actions in the Pages table.
The filter applies only to hierarchical post types. For non-hierarchical posts, the post_row_actions filter fires.
Usage
add_filter( 'page_row_actions', 'wp_kama_page_row_actions_filter', 10, 2 );
/**
* Function for `page_row_actions` filter-hook.
*
* @param string[] $actions An array of row action links.
* @param WP_Post $post The post object.
*
* @return string[]
*/
function wp_kama_page_row_actions_filter( $actions, $post ){
// filter...
return $actions;
}
- $actions(string[])
An array of page actions.
Array ( [edit] => <a href="https://example.com/wp-admin/post.php?post=127&action=edit" aria-label="Edit «Architecture»">Edit</a> [inline hide-if-no-js] => <button type="button" class="button-link editinline" aria-label="Edit properties of “Architecture”" aria-expanded="false">Properties</button> [trash] => <a href="https://example.com/wp-admin/post.php?post=127&action=trash&_wpnonce=5865cdb7e4" class="submitdelete" aria-label="Move “Architecture” to the Trash">Delete</a> [view] => <a href="https://example.com/architecture/" rel="bookmark" aria-label="View «Architecture»">View</a> )
Default: are 'Edit', 'Quick Edit', 'Restore', 'Trash', 'Delete Permanently', 'Preview', and 'View'
- $post(WP_Post)
- The post object.
Examples
#1 Prevent the specified pages from being edited
Changelog
| Since 2.8.0 | Introduced. |
Where the hook is called
wp-admin/includes/class-wp-posts-list-table.php 1690
$actions = apply_filters( 'page_row_actions', $actions, $post );