Support

Account

Home Forums ACF PRO Is it possible to add an ACF field to an existing metabox

Solving

Is it possible to add an ACF field to an existing metabox

  • Hey All,

    I have a bit of an obscure one for ya. I want to append an ACF field to a plugin metabox. The plugin has hooks to that would allow me to place additional fields, and I’d love to use the smooth UI of ACF’s relationship fields here.

    Is this possible?

  • I doubt it…

    Can you provide a bit more info ?
    I assume this is in the back-end ?

  • Sure thing. Imagine a metabox created by a an event calendar plugin. That metabox has date, time, etc in this metabox. There are hooks for me to append additional custom fields to this metabox. I want to add a relationship field to pull in post objects from a relevant cpt.

    I can do this directly, but I really like the ACF relationship field UI, and we’re using ACF elsewhere so it’s worth using if possible.

    Rich

  • I remember looking into the same, because I wanted to add something in my own meta box, but I wasn’t able to (or at least not in the way I wanted). I ended up writing my own custom one.

    Which events plugin is it ?

  • Events Calendar Pro. I’m likely just going to build it as a standard custom field.

    It’s an interesting idea, but maybe not worth the fuss.

  • I did the same 😉 so I can understand…

  • Is this possible today (Feb 2020)?

    This below code adds markup inside “submitdiv”. The div that holds Status, Visibility, Published on and Publish/Update button. I would like to add an ACF Checkbox field under those settings. Is this possible with some function, action or filter combination?

    add_action( 'post_submitbox_misc_actions', 'wpse_45720_submitdiv_extra' );
    //add_action( 'post_submitbox_start', 'wpse_45720_submitdiv_extra' );
    
    function wpse_45720_submitdiv_extra()
    {
        //print '<pre>' . current_filter() . '</pre>';
        echo '<div class="misc-pub-section misc-something" id="something">';
        echo '<p>Headline</p>';
        //ACF CHECKBOX FIELD HERE
        echo '<p>Some note under the ACF</p>';
        echo '</div>';
    }
    //reference: https://wordpress.stackexchange.com/a/45722

    If it’s not possbile then perhaps just show the checked selections (with get_field) and inform the user that in order to change the selections scroll to the field group titled “Your checkboxes”.

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

The topic ‘Is it possible to add an ACF field to an existing metabox’ is closed to new replies.