Forums

Custom Post Type Search Error (1 post)

  1. noorbakenoor
    Member
    Posted 1 year ago #

    I was trying something. First I created a custom post type with the following code:

    register_post_type('products', array( 'label' => 'Products','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => ''),'query_var' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array ( 'name' => 'Products', 'singular_name' => 'Product', 'menu_name' => 'Products', 'add_new' => 'Add Product', 'add_new_item' => 'Add New Product', 'edit' => 'Edit', 'edit_item' => 'Edit Product', 'new_item' => 'New Product', 'view' => 'View Product', 'view_item' => 'View Product', 'search_items' => 'Search Products', 'not_found' => 'No Products Found', 'not_found_in_trash' => 'No Products Found in Trash', 'parent' => 'Parent Product', ),) );

    Then I created a post of that type and assigned it a category. The post I created is now of custom type "Product" and has a category "IT". That post is viewable at http://localhost/wordpress/products/computer/ but no result is found at http://localhost/wordpress/products or http://localhost/wordpress/category/it/

Topic Closed

This topic has been closed to new replies.

About this Topic