4

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!

3

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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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