How do I extract just the post ID of the first item in whatever WP_Query returns?
If you only need the ID of a single post of a custom post type, to see if it exists, I’d suggest just using get_posts() with fields set to ids: $post_ids = get_posts( [ ‘numberposts’ => 1, ‘author’ => $current_user, ‘post_type’ => ‘my_custom_post_type’, ‘fields’ => ‘ids’, ] ); if ( isset( $post_ids[0] ) ) { … Read more