0

I have some custom meta fields. Some are date fields but WordPress saves everything as a string, so how can I compare the dates?

$meta_query_args = array(
    'relation' => '', // Optional, defaults to "AND"
    array(
        'key'     => 'my_custom_date_field',
        'value'   => '',
        'compare' => '>'
    )
);
$meta_query = new WP_Meta_Query( $meta_query_args );

I found this, but how can I add some more conditions with dynamic variable / prepared statement?

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.