Order is breaking wp_query

The root cause to my issue was using the custom post type of “order”. Once I changed that to something more specific things worked fine. A complete guess but I’m wondering if the post type being “order” and the issue being the “order” query argument caused a conflict.

Send email notifications to a defined email address depending if a product in order has a specific TAG [closed]

To check product has TAG or not you have to fetch product from order and search in them. //Custom NEW ORDER Email address depending on Product Tag add_filter( ‘woocommerce_email_recipient_new_order’, ‘new_order_conditional_email_recipient’, 10, 2 ); function new_order_conditional_email_recipient( $recipient, $order ) { if ( ! is_a( $order, ‘WC_Order’ ) ) return $recipient; // (Optional) // Get the order … Read more

How to change the order of the subcategory and category in a post?

You can write a get_the_terms filter to change the other the category values are returned, e.g. function sort_the_terms( $terms, $post_id, $taxonomy ) { if ( ‘categories’ === $taxonomy ) { usort( $terms, function( $term1, $term2 ) { // Better sort logic here return $term1->name <=> $term2->name; } ); } return $terms; } add_filter( ‘get_the_terms’, ‘sort_the_terms’, … Read more

Having Issue on Ordering CPT by Custom Field In Custom WP Query

Your query args are not quite correct. When you want to order by a custom field, you need to specify a meta_key argument, and set your orderby to the kind of ordering you need. For example: $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘topic’, ‘field’ => ‘slug’, ‘terms’ => ‘movie’, ), ), ‘post_type’ … Read more

Ordering posts by title containing numbers

What you’re asking is a generic (My)SQL question, but anyway, as I already said in my comment, if the post title is always in the form of TM.74.G.<number> like TM.74.G.358 and TM.74.G.1000, then you can use the SUBSTRING() function in MySQL/MariaDB to firstly extract the <number> value (e.g. 358) and then sort the posts by … Read more

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