How can meta values from another site in a multisite be used in a custom query?
How can meta values from another site in a multisite be used in a custom query?
How can meta values from another site in a multisite be used in a custom query?
You should be able to order your posts by adding the following to your main args: ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, Example: $args_post = array ( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘tipo-de-contenido’, … Read more
To be able to do this your post meta values need to be strings in a valid date format, e.g. 2022/01/31 for January 31st 2022. Note I used ISO standard timestamp format with the biggest value first, then everything descending, and avoided using a regional value such as 31/1/2022 from the UK, or 1/31/2023 from … Read more
get_meta_sql hook is not firing
There is one issue I see in your code. Within ‘meta_query’ you cannot use ‘meta_key’, but it should be ‘key’. For example: array( ‘key’ => ‘_reservation_date_hour’, ‘value’ => $GMT_checkHour,//the value it is grab using ajax form ‘compare’ => ‘>=’, ‘type’ => ‘DATETIME’, ) So with your previous code all ‘meta_key’ lines were ignored. To identify … Read more
WP_Query: how to sort all posts by date when one category has a custom “date” field?
This is likely not the “ideal” approach, but this works for me, and now I can move on to other things. If someone has a better option, I’d love to hear it, thank you. $base_args = [ ‘post_type’ => ‘crowdfunding’, ‘numberposts’ => 30, ‘posts_per_page’ => ’50’, ]; $meta_query = array( array( ‘key’ => ‘campaign_start_date’, ‘compare’ … Read more
SQL query based on two different custom field values
How can I filter records in a custom post type list in the admin based on the ACF field in the post that contains the current user?
WP_Query filtering in ACF field containing dates