Need Code Snippet for ID Column | Move from Last to First Column

[ad_1]

Here you go!

add_filter( 'code_snippets/list_table/columns', function ( $columns ) {
return [
'cb' => $columns['cb'],
'id' => $columns['id']
] + $columns;
} );

I believe that initially I chose this column order as it felt strange to not have the ‘name’ column, with all of the snippet actions, as the first column in the table next to the checkbox. I can definitely see the use-case for having ‘ID’ first, and given that it starts as hidden, there’s definitely an argument to be made that this could be a sensible default.

Hi @bungeshea,

Thank you for your quick response. Works great!

If you don’t mind, can you also provide one that moves the Priority column from (now) last to the second column (to the right of the ID column)?

Argument: Think of your main code snippets display page as a spreadsheet, where we can quickly sort and find our code snippets by key identifiers (i.e., by ID and criticality or “Priority” for quick viewing and modification). Also, the UI is a lot nicer 🙂

We’ll close this topic as “Resolved” once we hear back from ya.

Thank you!

Hi @bungeshea,

Never mind. We figured it out. See below.

Thank you!

————–

add_filter( 'code_snippets/list_table/columns', function ( $columns ) {
return [
'cb' => $columns['cb'],
'id' => $columns['id'],
'priority' => $columns['priority']
] + $columns;
} );

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer