Support

Account

Home Forums Backend Issues (wp-admin) Allow Archives URLs Custom Post Types

Solved

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!

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

The topic ‘Allow Archives URLs Custom Post Types’ is closed to new replies.