1 comment

  1. OK so was way simpler than I thought in the end and didn’t involve a query of query.

    The same can be achieved like this:

         /*GETING THE USERS FIRST PUBLISHED SUBSCRIPTION?? */
    $useremail = $ticket['email'];
    $user = get_user_by( 'email', $useremail );
    $IDuser = $user->ID;
    $args = array(
                  'posts_per_page' => 1,
                  'post_type' => 'subscription',
                  'author' => $IDuser,
                  'meta_key' => 'state',
                  'meta_value' => 'complete',
                  'orderby' => 'date',
                  'order' => 'ASC',
                  );
    $first_post = new WP_Query($args);
    //    '<pre>'.print_r($first_post).'</pre>'; // You can use this to check what the query produces to make sure you're on the right track.
    if ($first_post->have_posts()) {
        $first_post->the_post();
    
        the_time('M j, Y');
    
        wp_reset_postdata();
    

Comments are closed.