WP_Query order by date in meta_value

change your args as bellow $args = array( ‘post_type’ => ‘your_post_type’, ‘orderby’ => ‘meta_value’, ‘meta_query’ => array(array(‘key’ => ‘releaseDate’)), ‘order’ => ‘ASC’, ‘paged’ =>$paged, ); If you get the results ordered other way around, change ‘order’ => ‘DESC’, You’ll get the correct order.

Remove action from woocommerce barcode plugin [closed]

You need to access the class variable to remove a action which has been added within a class function remove_default_order_barcode(){ global $WooCommerce_Order_Barcodes ; remove_action( ‘woocommerce_order_details_after_order_table’, array( $WooCommerce_Order_Barcodes, ‘get_display_barcode’ ), 1, 1 ); } add_action(‘init’,’remove_default_order_barcode’); hope it will help you !

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

Re-order posts in query after

Given that meta is cached inside page load it should be reasonably performant to do it like this (not tested): usort( $wp_query->posts, function ( $post_a, $post_b ) { $a = get_post_meta( $post_a->id, ‘key’, true ); $b = get_post_meta( $post_b->id, ‘key’, true ); if ( $a == $b ) { return 0; } return ( $a … Read more

How to order posts (woocommerce products) alphabetically but ignore certain words, eg ‘The’ and ‘An’

Ok, worked it out via a little workaround. Add a new sorting function in Woocommerce, something like: https://gist.githubusercontent.com/bekarice/0df2b2d54d6ac8076f84/raw/wc-sort-by-postmeta.php works nicely, but remove the bit about meta values and keys since we’re not sorting by custom fields (though that could be a good workaround too). Change the orderby to be ‘name’. Eg post slug rather than … Read more

Orderby Post Views

You can sort your query by view number, using the meta key : $query = new WP_Query( array( ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ) ); This will query your posts based on the views. You can change DESC to ASC or RAND to achieve what you asked. To make it work … Read more

Order by menu structure

You may be able to use a WP_Query on nav_menu_item since it is its own post type. I’ve never done this but maybe it would work like you need it to, worth a shot. There are three other possibilities: Option 1 – Get Your Nav Menu Items There’s a functions called wp_get_nav_menu_items() which will return … Read more

How can I set custom order use this function

You will need to add term meta to your categories. In this metafield you will store the string or number that you want to use as a base for your custom order (tutorial). Let’s say you have generated a meta field called my_cat_meta which holds integers that say in which order you want them to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)