Home Forums General Issues Get the meta_id of an acf Reply To: Get the meta_id of an acf

  • Do you mean the Field Key?

    If so you could use
    get_field_object instead of the normal get_field.

    For example, this will display all related information from our field:

    <?php $myfieldname = get_field_object(myfieldname); ?>
    <pre><?php print_r($myfieldname) ?></pre>

    And this will display the Field Key from the above:
    <?php echo $text[key]; ?>

    We can skip all the above and do it in one line, on it’s own like this:
    <?php echo get_field_object('text')[key]; ?>