title: Custom Post Type Single page shows 404 error
body: <p>I am using Custom Post Type Permalinks
  By Toro_Unit plugin for customizing urls.</p>
  
  <p>Here is my custom post type</p>
  
  <pre><code>&lt;?php
  
  /**
   * Post Type: our-products.
   */
  function cptui_register_my_cpts_our_products() {
  
  
  
      $labels = array(
          "name" =&gt; __("Our Products", "twentynineteen"),
          "singular_name" =&gt; __("Product", "twentynineteen"),
          "menu_name" =&gt; __("Products", "twentynineteen"),
          "all_items" =&gt; __("Products", "twentynineteen"),
          "add_new" =&gt; __("Add Products", "twentynineteen"),
          "add_new_item" =&gt; __("Add New Product", "twentynineteen"),
          "edit_item" =&gt; __("Edit Product", "twentynineteen"),
          "new_item" =&gt; __("New Product", "twentynineteen"),
          "view_item" =&gt; __("View Product", "twentynineteen"),
          "view_items" =&gt; __("View Products", "twentynineteen"),
          "search_items" =&gt; __("Search Products", "twentynineteen"),
          "not_found" =&gt; __("No Product Found", "twentynineteen"),
          "not_found_in_trash" =&gt; __("No Product Found in Trash", "twentynineteen"),
          "parent_item_colon" =&gt; __("Parent Product", "twentynineteen"),
          "featured_image" =&gt; __("Featured Image", "twentynineteen"),
          "set_featured_image" =&gt; __("Set Featured Image for Product", "twentynineteen"),
          "remove_featured_image" =&gt; __("Remove Featured Image for Product", "twentynineteen"),
          "use_featured_image" =&gt; __("Use as Featured Image For Product", "twentynineteen"),
          "archives" =&gt; __("Product Archieves", "twentynineteen"),
          "insert_into_item" =&gt; __("Insert into Products", "twentynineteen"),
          "uploaded_to_this_item" =&gt; __("Upload to this product", "twentynineteen"),
          "filter_items_list" =&gt; __("Filter Product List", "twentynineteen"),
          "items_list_navigation" =&gt; __("Filter Product List Navigation", "twentynineteen"),
          "items_list" =&gt; __("Products List", "twentynineteen"),
          "attributes" =&gt; __("Product Attributes", "twentynineteen"),
          "name_admin_bar" =&gt; __("Products", "twentynineteen"),
          "parent_item_colon" =&gt; __("Parent Product", "twentynineteen"),
      );
  
      $args = array(
          "label" =&gt; __("our-products", "twentynineteen"),
          "labels" =&gt; $labels,
          "description" =&gt; "",
          "public" =&gt; true,
          "publicly_queryable" =&gt; true,
          "show_ui" =&gt; true,
          "delete_with_user" =&gt; false,
          "show_in_rest" =&gt; true,
          "rest_base" =&gt; "",
          "rest_controller_class" =&gt; "WP_REST_Posts_Controller",
          "has_archive" =&gt; true,
          "show_in_menu" =&gt; true,
          "show_in_nav_menus" =&gt; true,
          "exclude_from_search" =&gt; false,
          "capability_type" =&gt; "post",
          "map_meta_cap" =&gt; true,
          "hierarchical" =&gt; true,
          "rewrite" =&gt; array("slug" =&gt; "our-products", "with_front" =&gt; true),
          "query_var" =&gt; "our-products",
          "supports" =&gt; array("title", "editor", "thumbnail", "excerpt", "trackbacks", "custom-fields", "comments", "revisions", "page-attributes", "post-formats"),
      );
  
      register_post_type("our-products", $args);
  }
  
  add_action('init', 'cptui_register_my_cpts_our_products');
  
  function wpdocs_register_private_taxonomy1() {
      $args = array(
          'label' =&gt; __('Product Category', 'textdomain'),
          'public' =&gt; true,
           "publicly_queryable" =&gt; true,
          "show_in_rest" =&gt; true,
          'rewrite' =&gt; true,
          'hierarchical' =&gt; true,
          'has_archive' =&gt; true
      );
  
      register_taxonomy('product-category', 'our-products', $args);
  
  
      $labels = array(
          'name' =&gt; _x('Tags', 'taxonomy general name'),
          'singular_name' =&gt; _x('Tag', 'taxonomy singular name'),
          'search_items' =&gt; __('Search Tags'),
          'popular_items' =&gt; __('Popular Tags'),
          'all_items' =&gt; __('All Tags'),
          'parent_item' =&gt; null,
          'parent_item_colon' =&gt; null,
          'edit_item' =&gt; __('Edit Tag'),
          'update_item' =&gt; __('Update Tag'),
          'add_new_item' =&gt; __('Add New Tag'),
          'new_item_name' =&gt; __('New Tag Name'),
          'separate_items_with_commas' =&gt; __('Separate tags with commas'),
          'add_or_remove_items' =&gt; __('Add or remove tags'),
          'choose_from_most_used' =&gt; __('Choose from the most used tags'),
          'menu_name' =&gt; __('Tags'),
      );
  
      register_taxonomy('tag', 'our-products', array(// replace your post type with "news"
          'hierarchical' =&gt; false,
          'labels' =&gt; $labels,
          "show_in_rest" =&gt; true,
          'show_ui' =&gt; true,
          'update_count_callback' =&gt; '_update_post_term_count',
          'query_var' =&gt; true,
          'rewrite' =&gt; array('slug' =&gt; 'tag'),
      ));
  }
  
  add_action('init', 'wpdocs_register_private_taxonomy1', 0);
  
  
  flush_rewrite_rules( false );
  </code></pre>
  
  <p>I want to make urls of custom taxonomy</p>
  
  <p>site_url/our-products/custom-taxonomy-name</p>
  
  <p>and for single page</p>
  
  <p>site_url/our-products/custom-taxomony-name/single-page-url</p>
  
  <p>so when setting up </p>
  
  <p><a href="https://i.stack.imgur.com/P15rC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P15rC.png" alt="enter image description here"></a></p>
  
  <p>Url works fine. but it shows 404 error.</p>
  
  <h1>Tried: Not working at all</h1>
  
  <ul>
  <li><p>Permalinks flushed by settings-->permalinks-->custom structure-->save</p></li>
  <li><p>flush_rewrite_rules( false ) in functions.php and while creating
  custom post type</p></li>
  <li><p>Solution provided <a href="https://wordpress.stackexchange.com/questions/239701/custom-post-type-categories-gives-404-error">here</a></p></li>
  <li><p>Also tried <a href="https://stackoverflow.com/questions/8184971/wordpress-custom-post-type-post-and-category-links-404">this</a> solution</p></li>
  <li><p>.htaccess file : checked no issue with it.</p></li>
  <li>After all the frustration , installed a new setup,created a custom post type and set the permalinks as /%category%/%postname%/ , not
  worked for custom post type.</li>
  </ul>
  
  <p>just for reference am using wordpress 5.3.1 and there is no conflict  with theme or plugin. Tested.</p>