Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4606338
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:33:07+00:00 2026-05-22T00:33:07+00:00

I have a custom post type of Products in my WordPress project. The CPT

  • 0

I have a custom post type of Products in my WordPress project. The CPT has several custom fields and two taxonomies that can be attached to it. I can add/edit/delete all these in the wordpress admin without any problems.

My issue I’m struggling with now is DISPLAYING these Products custom post types on the front end. If I go into the EDIT PRODUCT admin section I can see the Permalink for each individual product ( I can even see links for each taxonomy) but clicking them brings up a 404.

I’d like to be able to link directly to products (for example http://localhost:8888/project/product/productname/) like its show in in Edit CPT page. I’d also like to list Products if they pick just the taxonomies for those products. Hope that makes sense.

Is there a way of doing this without having to make pages for each taxonomy and product? This is my first time displaying CPTs (any posts for that matter) so I’m having trouble wrapping my head around it. Do I need to make Pages for these?

Thank you!

Here is my custom post type:

/*  CUSTOM POST TYPE AREA FOR PRODUCTS  */
add_action( 'init', 'create_product_post_type' );

function create_product_post_type() 
{
    $labels = array(
        'name' => _x('Products', 'post type general name'),
        'singular_name' => _x('Product', 'post type singular name'),
        'add_new' => _x('Add New', 'products'),
        'add_new_item' => __('Add New Product'),
        'edit_item' => __('Edit Product'),
        'new_item' => __('New Product'),
        'view_item' => __('View Product'),
        'search_item' => __('Search Products'),
        'not_found' => __('No products found'),
        'not_found_in_trash' => __('No products found in Trash'),
        'parent_item_colon' => '',
        'menu_name' => 'Products'           
        );

    $args = array(
        'label' => __('Products'),
        'labels' => $labels,
        'public' => true,
        'can_export' => true,
        'show_ui' => true,
        '_builtin' => false,
        'capability_type' => 'post',
        'menu_icon' => get_bloginfo('template_url').'/functions/images/product.png',
        'hierarchical' => false,
            //'rewrite' => array( "slug" => "product" ),
        'supports' => array('title'), //MAYBE add thumbnail later!
        'show_in_nav_menus' => true

        );

        register_post_type( 'products', $args); 
}

//*********************************************************************//
//**************Custom Taxonomy for Products***************************//
//*********************************************************************//

/* CUSTOM TAXONOMY FOR PRODUCTS POST   */
function create_productcategory_taxonomy() {
    $labels = array(
        'name' => _x( 'Categories', 'taxonomy general name' ),
        'singular_name' =>_x( 'Category', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Categories' ),
        'popular_items' => __( 'Popular Categories' ),
        'all_items' => __( 'All Categories' ),
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __( 'Edit Product Category' ),
        'update_item' => __( 'Update Product Category' ),
        'add_new_item' => __( 'Add New Product Category' ),
        'new_item_name' => __( 'New Product Category' ),
        'separate_items_with_commas' => __( 'Separate categories with commas' ),
        'add_or_remove_items' => __( 'Add or remove product categories' ),
        'choose_from_most_used' => __( 'Choose from the most used categories' )
        );

    register_taxonomy('productcategory', 'products', array (
        'label' => __('Product Category'),
        'labels' => $labels,
        'hierarchical' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'product-category'),
        )); 
}

function create_product_type_taxonomy() {
    $labels = array(
        'name' => _x( 'Types', 'taxonomy general name' ),
        'singular_name' =>_x( 'Type', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Types' ),
        'popular_items' => __( 'Popular Types' ),
        'all_items' => __( 'All Types' ),
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __( 'Edit Product Type' ),
        'update_item' => __( 'Update Product Type' ),
        'add_new_item' => __( 'Add New Product Type' ),
        'new_item_name' => __( 'New Product Type' ),
        'menu_name' => __( 'Types' )
        );

    register_taxonomy('producttype', 'products', array (
        'label' => __('Product Type'),
        'labels' => $labels,
        'hierarchical' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'product-type'),
        )); 
}

add_action( 'init', 'create_productcategory_taxonomy', 0 );
add_action( 'init', 'create_product_type_taxonomy', 0 );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:33:07+00:00Added an answer on May 22, 2026 at 12:33 am

    Had this problem last week, the solutions i found:
    1- create a page that loops through all posts of a (or several) custom post type:
    http://codex.wordpress.org/Pages#A_Page_of_Posts_for_a_Custom_Post_Type that’s an exemple i found in wordpress documentation. So after creating that page template, you would just have to create a page in the admin and chose the template you just created.

    2- if you want to display the custom posts in the site’s main loop this code works great:
    http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

    3- finally in wordpress 3.1+ you can create single-{posttype}.php (ex: single-acme_product.php) to change the way the custom post type are displayed when in showing one.

    hope that could help you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WooCommerce site which has a custom post type named 'products'. Each
I have two custom post type: product and faq. The product post type has
I have a template that displays the titles of a custom post type. I
I observed that if I have a custom post type called article, the links
I have setup a custom Post Type in WordPress and have a question. How
I have setup a custom post type in Wordpress. It is a section where
I am using magic fields and have defined a custom post type called collection
I'm a newbie in WordPress. I have created a custom post type called arts
I have created a custom post type for my portfolio page. I have two
I have a Custom Post Type, 'ioni_codex' I am using built-in Wordpress category as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.