Support

Account

Home Forums General Issues Programatically insert data in ACF tab?

Helping

Programatically insert data in ACF tab?

  • Is it possible to programatically insert something in a empty tab? There isn’t anything written here https://www.advancedcustomfields.com/resources/tab/

    I have a few of these tabs to separate custom fields and in the last tab I would like to insert a list of Custom Post Type posts.

    Generally I have this type of code as a plugin class

    add_action( ‘add_meta_boxes’, array( $this, ‘add_meta_box_ctp_listing’ ) );

    public function add_meta_box_ctp_listing() {
    add_meta_box(
    ‘A list’,
    __( ‘Listing’, ‘myplugin_textdomain’ ),
    array( $this, ‘render_ctp_boxes’ ),
    array(‘post’),
    ‘advanced’,
    ‘high’
    );
    }

    and function render_ctp_boxes() just echoes every post as a list and beside every post there is a checkbox with its ID

  • Tabs hold other ACF fields and do not hold any data on their own. Actually, tabs really don’t hold anything, they are just separators what are used to create the “Tabs” when editing the values of the fields that are in them. What you need to do is add another type of fields and then dynamically generate the values of the fields. I’m not 100% sure what you’re attempting to show.

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

You must be logged in to reply to this topic.