0

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/

laurent
  • 67
  • 6

4 Answers4

1

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.

wojciech.k
  • 11
  • 4
0

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

laurent
  • 67
  • 6
0

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>';
    }
}
Sabbir Hasan
  • 101
  • 1
  • 5
0

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);
}
Michael Presečan
  • 162
  • 1
  • 3
  • 12