Support

Account

Home Forums Backend Issues (wp-admin) acf_add_local_field_grouop() not working from within plugin

Helping

acf_add_local_field_grouop() not working from within plugin

  • I have a snippet that works when it’s used in a theme, but not when it’s used in a plugin.

    https://pastebin.com/yt6GuskZ

    All of the fields correctly appear on my options page and work fine, except that the seamless mode doesn’t work (it’s the normal meta box). But the big problem is that this field group appears everywhere in the wp-admin… on posts, all my custom post types, etc. Basically the fields work but the style and location don’t work.

  • When doing this type of thing in a plugin is should be done inside an action.

    For example:

    
    add_action('acf/init', 'init_my_acf');
    function init_my_acf() {
      acf_add_options_sub_page('txt Importer');
      acf_add_local_field_group(...);
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘acf_add_local_field_grouop() not working from within plugin’ is closed to new replies.