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.
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.
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.
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.'));
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.
The topic ‘Add field group to specific post in Custom Post Type’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Sorry for the issues with ACF's API SSL certificate this morning. We've resolved it and your activations and downloads should be back to normal again. Thanks! ^LG— Advanced Custom Fields (@wp_acf) November 2, 2022
© 2022 Advanced Custom Fields.