Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've already found out here how to remove the row-actions from the posts table in wordpress admin. Now I'd like to do the same in the pages table. I've looked in the core files but, well, I just don't get it. Anyone?

Here's the code used in functions.php to remove row actions in posts:

function remove_row_actions( $actions )
{
    if( get_post_type() === 'post' )
        unset( $actions['edit'] );
        unset( $actions['view'] );
        unset( $actions['trash'] );
        unset( $actions['inline hide-if-no-js'] );
    return $actions;
}
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );

Thanks in advance!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

For non-hierarchical post types the filter is called post_row_actions, for hierarchical it's page_row_actions.

If you want to remove all actions you don't have to unset the individual items, you can just return an empty array.

add_filter( 'page_row_actions', 'wpse16327_page_row_actions', 10, 2 );
function wpse16327_page_row_actions( $actions, $post )
{
    if ( 'page' == $post->post_type ) {
        return array();
    }
    return $actions;
}
share|improve this answer
    
Just an FYI, for any users who found sources that claim these hooks are deprecated (i.e. Adam Brown's hook reference - if Adam Brown has since fixed this, please comment) ... know that they are NOT deprecated. (This misleading information was borne because the regex used for parsing the WP core code was no longer able to pick up these hooks since they were moved inside a ternary operator in WP 3.1.) –  smhmic Feb 17 '13 at 18:38
    
Adam Brown's reference was just fixed. adambrown.info/p/wp_hooks/hook/page_row_actions –  smhmic Feb 21 '13 at 23:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.