How to query for pages/post depending on slug?

With a custom Page (post type page) and a custom Page Template, you can do it like so: In the templates, make a new instance of WP_Query which is used for querying the posts in either the Romanian or English language. In the query/function args for WP_Query and wp_get_archives(), use a custom parameter named lang … Read more

ACF Date Based wp_query

I’ve modified your existing code.Can you please try the code bellow: $args = array ( ‘post_type’ => ‘exhibitions’, ‘meta_query’=> array( ‘relation’ => ‘AND’, array( ‘key’ => ‘exhibition_status’, ‘value’ => ‘past’, ), array( ‘key’ => ‘end_date’, ‘compare’ => ‘EXISTS’, ‘type’ => ‘DATE’ ), ), ‘meta_key’ => ‘end_date’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘post_status’ => ‘publish’, … Read more

Woocommerce returns Product post_status as published even tho it is in status draft

The solution is simple, delete the if check you’re having problems and add the post_status parameter to get_posts. For example: $args = [ ‘post_status’ => ‘publish’, ]; $only_published_posts = get_posts( $args ); Likewise we can pass an array of the statuses we do want, e.g. $args = [ ‘post_status’ => [ ‘publish’, ‘pending’ ], ]; … Read more