Home Forums ACF PRO Calling Custom Fields that Were Assigned to Custom Taxonomy?


Calling Custom Fields that Were Assigned to Custom Taxonomy?

    • gfreecd

    • April 28, 2021 at 9:39 am


    I have a custom taxonomy called Speakers and have custom fields assigned to that such as Speaker Bio, Speaker Photo, etc..

    I have another set of custom fields that are assigned to my posts and one of the fields selects a speaker name from the Speaker taxonomy. I’d like to dynamically pull the custom fields (Speaker Bio, Speaker Photo, etc.) that are assigned to that taxonomy but can’t figure out how to do that.

    I’m pulling the speaker name using the following code…

    <? $speakername= get_sub_field('speaker_name'); ?>
    <?php echo $speakername->name; ?>

    If I try the following code I can also pull the speaker name and description but I’m unable to pull any of the custom fields assigned to that taxonomy.

    <? $speakername= get_sub_field('speaker_name');
    $speakerbio= get_sub_field('speaker_bio');
    $speakerphoto= get_sub_field('speaker_photo');
    <?php echo $speakername->name; ?>
    <?php echo $speakername->description; ?>
    <?php echo $speakername->speaker_bio; ?>
    <?php echo $speakername->speaker_description; ?>

    Any idea how I can get this to work? If I’m not explaining this properly please let me know. Thanks in advance!

    $speakername= get_sub_field('speaker_name');
    $speakerbio= get_field('speaker_bio', $speakername);
  • Thanks so much! That fixed it 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.