• I’m looking to unset some actions within the page/post listing.
    I’ve found that code somewhere on the web, but the ‘post_row_actions’ seems to be deprecated (i’m using 3.4 version).
    Do you know what can I update in those lines of code to make them work ?

    add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
    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;
    }

    Thank you !

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    This works for me. For pages try:

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

    Thread Starter will83

    (@will83)

    I do not know why it didn’t work! It’s ok right now !
    But quick question, do you know how can I alter the post title link in the page/post list in admin ? If I want to disable “$action[‘edit’], i’ve to unset the post title link too !
    Thank you for your answer !

    ptriek

    (@ptriek)

    For future reference: although the name suggests otherwise page_row_actions also applies to (custom) posts with hierarchical structure, see source in wp-admin/includes/class-wp-posts-list-table.php: $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘post_row_actions in 3.4’ is closed to new replies.