The get_field_object
ACF function can be used to get info and options for a specific field.
First you need the field key of the specific field you wish to output. When editing a field group, click on the screen options tab at the top of the page. You should see an option to toggle the display of the field key (it is hidden by default to save space):
Once you have the key, you can load the field object and output its values:
$field_key = "field_5039a99716d1d";
$field = get_field_object($field_key);
if( $field )
{
echo '<select name="' . $field['key'] . '">';
foreach( $field['choices'] as $k => $v )
{
echo '<option value="' . $k . '">' . $v . '</option>';
}
echo '</select>';
}
Related Posts:
- If Custom Field is empty don’t display div
- Unique key for each row in a repeater field
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Importing hard coded custom field into acf field
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- How to use thumbnail size of image if I’m only using src to get image
- Advanced Custom Fields – display label and value only if value entered
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Creating an image from a custom field
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Including Custom fields within the_content
- Delete images from media library when user deletes an image from ACF Gallery
- Query on a repeater date (acf)
- ACF – Can’t get custom post type by taxonomy
- ACF Date fileds to Age Convert [closed]
- ACF number less than comparison not working
- How to update custom fields using the wp_insert_post() function?
- How to automatically apply woocommerce product title to all product images alt tags?
- The values of custom fields are not available functions.php
- get_post_custom single array
- how to increase custom post value by one most efficiently?
- ACF: Only get first row of a Repeater Field
- Using Advanced Custom Fields to create a per page slider
- Passing the custom field values in the wp_get_current_user array function
- Display PHP within HTML values
- Custom profile field with birthday. Troubles with
- wordpress allow user to edit user profile with custom fields
- Unable to write multiple values back to ACF user field – PHP
- Update grandchild repeater field with value per row
- auto-populating custom nav with all items from custom post type
- Sort by page information by Ascending Numbers
- Automatic Shortcode Creation with Custom Fields [closed]
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- How to combine 2 php functions into one function with a custom field
- Saving zero in meta box
- Download PDF after CF7 form submission
- How to check if a PHP string is different than meta field?
- Why does this update_post_meta function not delete the custom field itself?
- Only show image from custom field when present
- Upload non-featured image to image field
- Hide Heading if ACF Field is empty
- Custom meta box values are not getting saved for my custom post type
- HTML Special Characters in URL string [closed]
- WP_Query: getting posts where custom field exists
- InnerBlocks with allowedBlocks not working with acf_register_block
- Accessing values from ACF sub field (flexible content area) in PHP
- User Meta Value not echoing despite Var_Dump Showing correct string
- WP All Import / Update stock quantity from multiple XML files
- Getting taxonomy category Image from ACF [closed]
- Concatenate Custom Field Value & HTML Value
- `update_post_meta` not working anymore
- Unable to render custom field after attempt to generate a list of recent post in page template
- Hide a div when a custom field is empty
- Conditional On custom field plugin metabox
- Filter unique custom field value based on custom taxonomy category or other custom field
- Display background color or image with custom meta box?
- Meta boxes only displayed when editing normal (default wp post_type) posts
- WordPress stripping out custom field tags
- Using an “IF” statement based on the existence of custom field
- Query pulling a single post per month
- How to create repeater field manually, without plugin (ACF Pro)?
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Adding a custom meta field with default NULL value which is not selectable
- How do you save the values from custom fields to a products data
- Products listing check if meta checkbox is checked
- Bootstrap 4 Carosuel with ACF Repeater field
- Is it possible to update the dataset using update_post_meta
- Hide a div if the fiels is empty
- How to display acf field values from home page on all pages?
- Set ACF on order during checkout
- Inserting a class on before_widget if checkbox is checked
- What is the correct way to search 3 custom fields only in WordPress?
- Get field value and use as variable in php
- wp_get_nav_menu_items() with ACF
- How do I get the value of a current user’s custom field?
- get_template_part() not working with Advanced Custom Fields plugin
- List all ACF field values across every post on one page
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- How can I copy an ACF field to AIOSEO field? [closed]
- Get field in readable word
- Make sticky post with FacetWP
- WooCommerce Custom Tab with ACF Repeater Field
- PHP for loop not working as intended
- Get meta_query value by user meta array
- Else if Statement for Advanced Custom Fields [closed]
- Custom fields changes the formatting of metabox input
- Include a custom field in mysql query
- Display Content Based on Custom Field Value
- How to link a word comprised of a custom field with another?
- Custom field in title
- How can I put a custom field as the link of a button shortcode?
- get_category only returning details for ‘uncategorized’
- I want Page titles and excerpts to show up on home.php in certain order
- Posts sortable column not sorting properly for custom field numbers
- Save custom field value to variable for conditional – why is this not working? [closed]
- Advanced custom fields Repeater conditional statement not working [closed]
- advanced custom fields: repeater field within conditional statement [closed]
- I want to show image from custom field image on my custom page template
- Search custom post type posts only by meta fields?