Home › Forums › Backend Issues (wp-admin) › Allow Archives URLs Custom Post Types
Hi
I’m looking to add CPT to Allow Archives URLs under page links, anyone have any idea how to achieve this?
I’m assuming that you’re using ACF4.
ACF5, currently only available in the Pro version, includes archives and taxonomies in the page link field.
Im using PRO 5.4.4 which includes Archives but its not displaying Custom post type Archives, any ideas?
What is the setting for “has_archive” for your custom post type? Post types with archives show the archive url in the page link field for me.
hmm do you have any other CPT settings, I have "has_archive":"true"
That is the only setting I see that effects it.
Do the the single posts in this post type appear for selection?
How are you registering the CPT?
This is my CPT registration code:
add_action( 'init', 'cptui_register_my_cpts_gallery' );
function cptui_register_my_cpts_gallery() {
$labels = array(
"name" => __( 'Gallery', '' ),
"singular_name" => __( 'Gallery', '' ),
);
$args = array(
"label" => __( 'Gallery', '' ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"has_archive" => true,
"show_in_menu" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => array( "slug" => "gallery", "with_front" => true ),
"query_var" => true,
"menu_position" => 5,
"supports" => array( "title", "thumbnail" ),
"taxonomies" => array( "category", "post_tag" ),
);
register_post_type( "gallery", $args );
}
I set up a post type with all the same settings and I’m not seeing a problem.
Could you have some plugin that’s already using a post type named ‘gallery’?
Deactivate plugins to see if there’s a conflict.
Thanks John! I was using CPT plugin to register post types and it must of been conflicting somewhere. I manually set up CPT’s and it now works, thanks John!
The topic ‘Allow Archives URLs Custom Post Types’ 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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.