Support

Account

Forum Replies Created

  • This answer marked as private, so this is my contribution:

    
    <?php
    global $wpdb;
    $posts = $wpdb->get_results( '
    	SELECT
    		wp_posts.ID,
    		wp_posts.post_title,
    		wp_posts.post_content
    	FROM wp_posts
    	INNER JOIN wp_postmeta
    		ON wp_posts.ID = wp_postmeta.post_id
    	WHERE
    		wp_postmeta.meta_key = "your_acf_date_var"
    		AND wp_posts.post_type = "your_post_type"
    		AND wp_posts.post_status = "publish"
    	GROUP BY wp_posts.ID
    	ORDER BY wp_postmeta.meta_value ASC
    ' );
    foreach ( $posts as $key => $value ) {
    	var_dump( $value->post_title );
    }
    ?>
    
Viewing 1 post (of 1 total)