Home Forums Backend Issues (wp-admin) Add field group to specific post in Custom Post Type


Add field group to specific post in Custom Post Type

  • I have a custom post type set up. The custom post type is set up to not be public. When creating a field group, under rules, I can select the post type as where I want to add the field but I cannot select a specific post in that post type.

    Not sure if this is an issue with ACF or my custom post type. Is there some specific setting I can add to the post type? I need it to be non-public, non-searchable and I need to be able to add field groups to specific posts in the custom post type.

  • Figured this out for anyone that has the same problem.

    When creating a custom post type, if you want to be able to choose specific posts in the post type then the value of the argument ‘capability_type’ must be ‘post’

    Not sure if this was intended or not.

  • Hi @Hube2

    Thanks for the report. Can you take a screenshot to demonstrate which location rule select field is the issue?


  • As you can see in this first image, when the capability_type of the custom post type is “post” you can select a specific post to add the field group to.
    Image 1
    In these next two the capability_type of the custom post has been changed to page page then a specific post cannot be selected, unless I’m still missing something.

  • Hi @Hube2

    Can you please provide the code you are using to register your post_type. I’ll try to re-create the situation on my environment and find the issue


  • register_post_type($this->slug,
      array('label' => 'Supplemental Content',
           'public' => false,
           'show_ui' => true,
           'show_in_menu' => true,
           'show_in_nav_menus' => false,
           'capability_type' => 'page',
           'hierarchical' => false,
           'rewrite' => false,
           'query_var' => true,
           'exclude_from_search' => true,
           'menu_position' => $this->options['post_type']['menu_position'],
           'supports' => $this->options['post_type']['supports'],
           'labels' => array ('name' => 'Supplimental Content',
                              'singular_name' => 'Page',
                              'menu_name' => 'Supplimental Content',
                              'add_new' => 'Add Page',
                              'add_new_item' => 'Add New Page',
                              'edit' => 'Edit',
                              'edit_item' => 'Edit Page',
                              'new_item' => 'New Page',
                              'view' => NULL,
                              'view_item' => NULL,
                              'search_items' => 'Search Pages',
                              'not_found' => 'No Pages Found',
                              'not_found_in_trash' => 'No Pages Found in Trash'),
           'description' => 'This post type has been added by the plugin 
                            "Supplimental Content". It allows the user to create 
                            content that can be added to archive pages on the site. 
                            For more information read the documentation for the plugin.'));
  • In the above code
    'capability_type' => 'page'
    is what caused the problem, if I change that to post, then there isn’t a problem.

    For now I’m using ‘post’, It isn’t a huge difference in this case. Really just wanted people to be aware of it.

  • Hi @Hube2

    Thanks again for the bug report. I have tracked down and fixed the issue.

    The issues seems to come from a core WP function called get_pages which is not currently working well with custom post types in WP 3.7.1

    I have updated the code to use the better get_posts function and you can find the update on github.


  • Hi,

    I ran into the exact same problem as Hube2 today. Elliot, you said the problem was fixed, did you release the update? I’m still having the exact same issue. I can’t pick a specific “page” of a custom post type.

  • Hi

    The problem is fixed, but a new version of ACF has not been officially released.
    For now, you can download the latest version via github.


  • Thank Elliot. I will check github.

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

The topic ‘Add field group to specific post in Custom Post Type’ is closed to new replies.