Home Forums General Issues Issue registering checkbox fields via PHP


Issue registering checkbox fields via PHP

  • Hi,


    I’m using this code to register a checkbox custom field:

    	'key' => 'group_5de673be0cb12',
    	'title' => 'Reports',
    	'fields' => array(
    			'key' => 'field_5de675a5ce3f5',
    			'label' => 'Category',
    			'name' => 'report_category',
    			'type' => 'checkbox',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			'choices' => array(
    			'allow_custom' => 1,
    			'save_custom' => 1,
    			'default_value' => array(
    			'layout' => 'vertical',
    			'toggle' => 0,
    			'return_format' => 'label',
    	'location' => array(
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'report',
    	'menu_order' => 0,
    	'position' => 'acf_after_title',
    	'style' => 'default',
    	'label_placement' => 'top',
    	'instruction_placement' => 'label',
    	'hide_on_screen' => '',
    	'active' => true,
    	'description' => '',

    Note the option to ‘allow_custom’ and ‘save_custom’ values is set to 1 or true (I tried both). However, after I add a a new value and save the page its on, the value is not available as an option when I create a new page.

    However, when this field is created manually in Advanced Custom Fields settings, it does show saved values/options.

    Any idea why its not saving when added with PHP above?


  • Yes, this does seem to be a problem. Please submit a bug report here

    • chrwald

    • September 28, 2020 at 10:28 pm


    are there any news regarding this. I just stumbled upon the same problem on one of our site. If the fields are registered via the backend, the custom values are available on new posts. When registering the field via php, custom values only are available for the posts, there were created on.


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.