Support

Account

Home Forums Backend Issues (wp-admin) Register fields with plugin and PHP

Helping

Register fields with plugin and PHP

  • 1. Install WP
    2. Create basic plugin.
    3. Export fields to PHP and use them at plugin.php.

    Fields are not visible at admin view. (Group is visible but not fields.)

    <?php
    /*
    Plugin Name: Basic Plugin
    Plugin URI: https://example.com/
    Description: A basic WordPress plugin.
    Version: 1.0
    Author: Your Name
    Author URI: https://example.com/
    */
    
    if ( function_exists('acf_add_local_field_group') ):
    
        acf_add_local_field_group(array(
            'key' => 'group_642d1865aacd8',
            'title' => 'Title',
            'fields' => array(
                array(
                    'key' => 'field_642d18652e847',
                    'label' => 'Title',
                    'name' => 'title',
                    'aria-label' => '',
                    'type' => 'text',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'maxlength' => '',
                    'placeholder' => '',
                    'prepend' => '',
                    'append' => '',
                ),
            ),
            'location' => array(
                array(
                    array(
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'post',
                    ),
                ),
            ),
            'menu_order' => 0,
            'position' => 'normal',
            'style' => 'default',
            'label_placement' => 'top',
            'instruction_placement' => 'label',
            'hide_on_screen' => '',
            'active' => true,
            'description' => '',
            'show_in_rest' => 0,
        ));
    
    endif;
  • This is fixed at 6.1.2 release.

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

You must be logged in to reply to this topic.