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?
$wpdb
just make sure you always useprepare()
for safety.