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]; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.