Support

Account

Home Forums General Issues Query cpt then echo if relationship exists Reply To: Query cpt then echo if relationship exists

  • Thanks aregmk – have added set_postdata($addon) after the foreach but not getting the right result, i.e. getting same result if item is in the relationship or not.

    Adding the post_id onto the add_on_suites gives me the opposite result. Note: add_on_suites is not a field of the addons cpt – it is a field on the current post (i.e. the relationship exists on this post to the addons cpt).

    Wondering if it could be the $included query <?php if( $included ): ?> is just checking if ‘anything at all’ is included and if so, then giving me a tick?