0

I'm building a booking for events, each event is divided into taxonomies, this is the query that regulates my custom post type, to display all the posts that are under the "aperitivi" taxonomy.

$v_args = array(
    'post_type'     =>  array('eventi-suite'), // your CPT
    'posts_per_page'    => -1,
    'order'      => 'ASC',
    'orderby' => 'metakey_AMC_data',
    'meta_query' => array(
        array
        (
            'key'     => 'metakey_AMC_data',
            'compare'   => '>=',
            'value'     => date( 'd-m-y', current_time( 'timestamp', 0 ) ),
        ),
    ),
    'tax_query' => array(
        array(
            'taxonomy' => 'categoria',
            'field' => 'slug',
            'terms' => 'aperitivi'
        )
    )

);

The problem is that the post date is within the meta_value that corresponds to the meta key:metakey_AMC_data, obviously this date inside the db is in the form of a string, reason why in order not to let me exit events that have a date prior to the current one, I got the date through the mysql time table.

My problem is this I can't see the posts between the months.

Example: I see all posts until September 30, 2019, but not those of October 1, because obviously the query does not recognize that the October 1 date is larger than September 30, how can I show all future events?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.