Sorting for custom column in WordPress admin post table

The filter name is slightly off – use manage_edit-st_kb_sortable_columns. As for the actual sorting not working, you need implement the logic yourself: function wpse_208315_sort_by_status( $query ) { if ( $query->is_main_query() && $query->get( ‘orderby’ ) === ‘statuses’ ) { $query->set( ‘meta_key’, ‘status’ /* Post meta field name of status */ ); $query->set( ‘orderby’, ‘meta_value’ ); } … Read more

Multi-level ordering in WordPress

Multiple orderby with different sort order values are possible as of WordPress 4.0, take a look at the codex page for WP_Query – Order – Orderby Parameters. There is an related Make WordPress Core article too. The following example would comply to what you want: $query = new WP_Query( array( ‘orderby’ => array( ‘name’ => … Read more

wordpress custom_meta ordering of timestamps

Maybe I’m looking too simply, but your code sets the order_by for the query here: ‘orderby’ => ‘meta_value_num’, If you change that to “post_date” it should put them in date order, though you may want to look at the other sorting options here: WordPress get_posts function

Creating a category page by alphabet

So, i used this script in the end, thanks to Pieter Goosen’s post Category Alphabet List Broken $terms = get_terms(‘anime-on-going’); if ( !empty( $terms ) && !is_wp_error( $terms ) ){ $term_list = []; foreach ( $terms as $term ){ $first_letter = strtoupper($term->name[0]); $term_list[$first_letter][] = $term; } unset($term); echo ‘<ul class=”my_term-archive”>’; foreach ( $term_list as $key=>$value … Read more

get_terms orderby name as numbers

I know this post is very old but still answering for others who reach here. Following is a very simple filter to sort the terms as numbers. You only need to set the variable $taxonomy_to_sort with taxonomy slug and place it in functions.php of your theme. add_filter( ‘get_terms_orderby’, ‘terms_order_as_number’, 10, 3); function terms_order_as_number($order_by, $args, $taxonomies){ … Read more

Sorting by tag or category

The function get_posts() allows you to set parameters for both categories and tags. You could build two drop down boxes that list all categories or tags and then use JavaScript or just make a new page to sort these. What other information do you need?

Adding Sorting to Website?

Extending this answer for custom post type support. For a custom post type you can pass an extra parameter ( post_type ) to url, example – www.example.com/?post_type=FOO&orderby=title&order=dsc Note – If you’ve specified some url rewrite for that post type then the above url will become something like this but still showing all posts of post … Read more

Get “wp_get_nav_menu_items” to sort alphabetically [duplicate]

Absolutely no idea why I got a negative vote on this. Turns out this is actually a bug in wordpress: https://core.trac.wordpress.org/ticket/15533 The solution is to use “object” instead of “array”. $args = array( ‘orderby’=> ‘title’, ‘output’ => object); Hope it helps someone else.

techhipbettruvabetnorabahisbahis forumuedusedusedueduedusedusedueduedusedus