Home Forums Backend Issues (wp-admin) Dropdown ACF Fields


Dropdown ACF Fields

  • Hello,

    I want to create a dropdown in the admin with the ACF Fields but that doesn’t work… (for my custom post type)
    I use the function get_field_objects() but it seems doesn’t work in the wp-admin…
    Is it really an object ? Because i need to make it object…

    	function arrayToObject( $array ){
    		foreach( $array as $key => $value ){
    			if( is_array( $value ) ) $array[ $key ] = arrayToObject( $value );
    		return (object) $array;
        $of_fields = array("Select a Field" => '');
    	$of_fields_obj = get_field_objects();
    	$of_fields_obj = arrayToObject($of_fields_obj);
    	foreach ($of_fields_obj as $of_field) {
    	    $of_fields[$of_field->label] = $of_field->name;

    How can i have an array() not empty in back-end with the Label/Name of fields from my custom post type ?
    Any idea ?

  • Hello,

    Any idea for my problem or i need to make a better explain ?

    Thank you

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

The topic ‘Dropdown ACF Fields’ is closed to new replies.