How to always show row-action in pages list in wordpress administation

1.7k Views Asked by At

I would like to always show a row-action ("edit", "quik-edit","trash","display") in custom pages list in wordpress administation. Not just on hover the title.

I don't understand the codex about that :

https://developer.wordpress.org/reference/classes/wp_list_table/row_actions/

4

There are 4 best solutions below

0
wojciech.k On

Link which you provided include path to file you should edit.

File: wp-admin/includes/class-wp-list-table.php

In line number 512:

protected function row_actions( $actions, $always_visible = false )

Change the false value to true,

Hope it'll help you.

0
laurent On

Slowly by slowly will be ok.... If I change this argument is always visible thank you very much... but if i update wordpress in few month it will be "false" again... I think i have to do something like that in my function file:

function still_visible($always_visible){
    $always_visible = true;
    return  $always_visible;
}
add_filter( 'page_row_actions', 'still_visible');

But it doesn't work.... I have this php error :

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/mysite/wp-admin/includes/class-wp-list-table.php on line 513

Warning: Invalid argument supplied for foreach() in /var/www/vhosts/mysite/wp-admin/includes/class-wp-list-table.php on line 521

Blockquote

0
Sabbir Hasan On

Here is very simple css fix. Replace 'my_cpt' with your post type. And replace column-title with your primary column. Then see the magic. It's not the perfect fix but it's a working one!

add_action( 'admin_head', 'my_cpt_datatable_style' );

function my_cpt_datatable_style(){
    global $post_type;

    if($post_type == 'my_cpt'){
       echo '<style type="text/css">';
       echo '.column-title .column-action > .row-actions{ left: auto !important;  }'; // My primary column is column-title;
       echo '</style>';
    }
}
0
Michael Presečan On

If you are making your own custom table, then by extending the WP_List_Table class you can override this method, in following way:

public function row_actions($actions, $always_visible = false) {
  return parent::row_actions($actions, true);
}