Support

Account

Home Forums General Issues Query post with get_field() Reply To: Query post with get_field()

  • You need to capture the current ID outside of the loop, otherwise get_the_id() will grab the ID of the post it is currently querying.

    Try moving that chunk of code before the while, e.g.:

    <?php
      if ( is_singular( 'playlists' ) ):
        $current_category = get_field( 'categorias', get_the_ID() );
        if ( have_posts() ):
    ?>