0

post_row_actions, This filter does not bring all the actions when I try to print_r

public function remove_quick_edit($actions) {

        global $post;

        echo "<pre>";
           print_r($actions);
        echo "</pre>"; 

        $link_get = get_delete_post_link($post->ID);

        if ( $post->post_type == 'cs_flags' ) {

            unset($actions['inline hide-if-no-js']);
            unset($actions['trash']);                           

            $actions['delete'] = '<span class="trash"><a class="submitdelete deletion" href="' . get_delete_post_link($post->ID, '', true) . '">' . esc_html__('Delete', 'jobhunt') . '</a></span>';                
        }

        return $actions;
    }

The result it brings is only views it should bring edit and trash also but only view is there.

I was debugging why get_delete_post_link not working, so I found this issue maybe they are related to each other.

http://prntscr.com/gxz0fu

Custom post type code

$args = array(
            'label' => __( 'Flags' ),
            'description' => esc_html__( 'This is Description' ),
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => 'edit.php?post_type=jobs',
            'menu_position' => true,
            'supports' => array( 'title' ),
            'exclude_from_search' => true,
            'capabilities' => array(
        'create_posts' => false,
        'delete_posts' => true
    )
        );
        register_post_type( 'cs_flags', $args );
    }
  • Can you please write you question in English. "Post row actions filter" is something ethereal. – Max Yudin Oct 16 '17 at 8:13
  • 'capabilities' => array( 'create_posts' => false, 'delete_posts' => true ) is not the correct way to use this argument. It's probably interfering with your capabilities. Refer to the documentation. – Jacob Peattie Oct 16 '17 at 8:39
0

After some online searching I found a key to add in my arguments array of custom post type, map_meta_cap => true this brings the View, Edit, Quick Edit, Trash and that resolved my post delete issue also. I would like to recommend the following documentation who ever get stuck in such situation :)

https://codex.wordpress.org/Function_Reference/register_post_type

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.