In my wp_posts table I want to select the rows where post_type == event. I also want to a connection with wp_postmeta from the specific row. In my wp_postmeta table I want to do a where like this: Where post_id == (post id from wp_posts) and the meta_value from meta_key == event_date_end_timestamp is older than now.

So in my wp_postmeta I have :
enter image description here

But how can I form my query to do this?

$args = array(
    'posts_per_page' => -1,
    'post_type' => 'event',
    'meta_query' => array(
            'key'     => 'event_date_end_timestamp',
            'value'   => time(),
            'type'    => 'numeric',
            'compare' => '<'

$programs = new WP_Query($args);
<?php while($programs->have_posts()): $programs->the_post(); ?>
    <h1><?php the_title(); ?></h1>
<?php endwhile; ?>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.