On the list tables of the administration panels, I want to change the order of the filters on top of the table.
What I want:
- Pending
- Published
- All
I tried to act on a line from the “wp-list-table” file which is by default:
$status_links = array_merge(
array_slice( $status_links, 0, $split ),
array_slice( $status_links, 0, $split )
);
The default display is this:
- All
- Published
- Pending
And if I change it to this:
$status_links = array_merge(
array_slice( $status_links, 1, $split ),
array_slice( $status_links, 0, $split )
);
I get this order:
- Published
- Pending
- All
And if I change it to this:
$status_links = array_merge(
array_slice( $status_links, 2, $split ),
array_slice( $status_links, 0, $split )
);
I get this order:
- Pending
- All
- Published
I believe I will never get what I want from there as this only shifts the sequence but doesn’t reorder it.
How can I do to get my specific order then?
PS: I don’t use the “Scheduled” status and never will.
Thank you.
EDIT:
I Found the solution:
$status_links = array
(
$status_links["pending"],
$status_links["publish"],
$status_links["all"]
);
Thank you
Filter
views_edit-post
.You can juggle that new array however you want. The only keys that are present in the incoming array are the one that have posts so you should check that the key is set before trying to use it. Otherwise, that should do it.