I see you edited your post, did you get it to work for that first part?
now for your edit, you need to give more context. I am able to get the archive link and content using that function. Most likely, you have another code or customization that is conflicting with this function in your setup.
I would check
- The post type has the
has_archive
args is set totrue
. - Flush the rewrite rules to make sure they are clean.
- Look at the timing of your hook call to make sure it is called after your post type is setup
Related Posts:
- Get category id from post id of a custom post type
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Custom-Taxonomy as categories: Remove “most-used” tab?
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- Change / Delete the default post type and category?
- List all custom post type posts from a given category?
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Is there a way to list posts of only a certain category
- Taxonomy structure of Sport site
- get custom post type categories
- How to display recent / random posts by its category
- Custom post types and permalink
- Query Custom Post Types & category_name?
- How do I get the child category posts from a custom post type?
- Search doesn’t find tags or categories in custom post types
- Return array of categories to php function for current post
- Querying Term Posts in Loop
- Get Post Primary Category
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- How to add custom post types to normal category pages
- Add category attribute to custom shortcode
- Linking to the most recent post in a Custom Post Type
- Posts from all the categories are being displayed instead of particular category
- Conditional Statement custom post type category
- Categories sorting
- How can I make my custom posts appear in their assigned category url?
- Allow user to set custom order to a list of custom taxonomies?
- forming WP_Query for posts of all post types but from specific categories
- wp_list_categories() – current-cat class also inside posts?
- PHP variable not regenerating when publishing multiple posts at the same time
- Problem with displaying posts in the CPT category
- Custom Post Types with a common category for a blog listing
- Post injections into Site Origins Page builder [closed]
- Not sure if I should create multiple custom post type [closed]
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- How do you create a custom template to display a category with an image and related posts below?
- List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
- Categorise Custom Post Types
- Category.php template for custom posts
- in_category for custom post types
- Archieve.php not loading for custom post type
- Category archive in with conjunction with custom post type is empty
- WP_Query Custom Post Type if Category ID Equals
- Assign category a default post type
- List Posts By Custom Taxonomy
- How to Display Posts From Category Within a Custom Taxonomy?
- Showing custom post type categories in the menu
- Need help deciding on a taxonomy
- Category Icon on custom post type
- Listing all slugs?
- Get Posts by Category, Tag , and CPT Taxonomy
- List categories, subcategories and posts from custom taxonomy and custom post type
- Categories won’t appear on custom post type
- Get child categories of custom taxonomy category?
- Create query for both custom post type and category
- Get terms for a specfic post from multiple taxonomies in custom post type
- Add Extra Category Field to CPT Categories
- cannot achieve this structure (custom posts VS categories VS ??)
- Custom post type, taxonomy and admin bar
- Displaying taxonomies as category links within sidebar and creating pages for these
- Display all Categories except ones with a specific parent
- Custom post category name showing empty
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Custom post type archive page filters
- Custom query using one category that is used in all custom post types
- get taxonomies from terms
- Sudden 404 pages on product category archives
- Convert category to custom post type
- How can I display a specific category on Front-Page
- Show Custom Post Type based on Category on Archive Page
- Convert With Custom Post Type
- To display the category of a specific custom post type
- How to seperate posts by categories?
- WooCommerce change
- Adding categories to custom post type in permalink
- Custom category taxonomy – archive page not showing up
- Custom Post Type is not respecting assigned categories
- Help with Travel Guide Setup
- Custom post type category archive URL redirects to home page
- Project Category Heading
- Getting Custom post category from Form
- How can I generate a list of post-type specific categories?
- Front end page submission form does not attach custom post type
- Best way to structure article and issue relationship for CPT
- Custom Post Type used for FAQs Accordion
- Category slug not showing for Custom Post Type
- Get a list of categories ids
- How to call Shortcode categories for custom post types?
- category page template for custom post type
- How to filter posts by categories?
- Custom Post Type Permalinks with %category%
- Stop header code from showing in category page?
- Custom Post Type order Title ASC
- Return Custom Post Type Categories
- Loop category including custom post type
- Using tax_query to get single post per category
- create category upon saving post and save post in that category
- How do I turn CPT automatically also into category?
- What Is My Fault With This WP_QUERY ? [ Pagination Problem ]
- Is it possible to make is_category() recursive?