Loop through two different sets of custom fields

Your question literally doesn’t quite sound like “combining” loops, that’s usually different thing in WP terminology.

Following it literally you already know the part that outputs artist name you want — the_field('artist_name').

What probably confuses it in first context is that it’s not really a normal WP loop. Note how that call doesn’t specify which post artist name should be for? That conventionally comes from global post if omitted. You are not setting up post globals at all in your first snippet.

Since the_field() isn’t even WP function I assume you use one of numerous custom fields frameworks. You will have to consult its documentation how to retrieve the data for a specific post, provided by ID explicitly.

Leave a Comment