I found solution. Big Thanks @Scribu Alternative to query_posts for main loop? Now works fine and no more 404 error.
function wpse49295_alter_the_query( $request )
{
$dummy_query = new WP_Query();
$dummy_query->parse_query( $request );
if ( $dummy_query->is_single() )
$request['post_type'] = 'topic';
return $request;
}
add_filter( 'request', 'wpse49295_alter_the_query' );
Related Posts:
- Rewriting a custom-post-type permalink with taxonomy term?
- Remove custom post type slug from URL
- Custom post type, no need for single view, plus want permalink rewrites that include hash in URI
- Using /%postname% for a custom post type
- Why would WordPress use ‘attachment’ in a custom post type’s query string?
- Custom post type URL with post ID that allows archiving and paging
- Changing the URL Structure of a Paginated Custom Post
- Custom post type taxonomies URL rewrite
- Enforcing canonical URLs with multiple custom post types
- Create permalink structure for one taxonomy archive per custom post type
- Custom permalinks
- Issues when rewrite rules collide?
- Custom post type permalink changing itself every other change
- Custom post type’s get_permalink returns wrong url
- Custom post type permalink structure with the category also acting as an archive
- Prepend meta_value to permalink of post
- How to create custom URLs for Custom Post Type sub sections?
- Custom Permalinks for Custom Post Types and Taxonomies
- Custom Post Type Rewrite Rule for Author & Paging?
- Removing parent slug from URL on custom post type
- Multiple parameters in a custom post type url rewrite
- URL rewrite and navigation structure for wordpress custom post type
- How to properly prefix blog post URL’s
- Custom post type category, taxonomy and URL rewrite problem
- Rewrite on custom post type permalink not working?
- Custom post-type in root directory, blog posts in subdirectory
- Custom Post Type/ Taxonomy URL rewrite
- Custom query variable – get wordpress to redirect to nice permalink url
- how to get archive urls with same origin for custom types and terms?
- Permalinks for Taxonomy and Custom Post Type
- Multisite with a single, shared custom post type, while retaining site URL
- Share parent path between Custom Post Types and Pages?
- Pretty URLs for Custom Post Type & Custom Taxonomy with Duplicate Slugs on WPML
- Rewrite URL for only archive page (custom post type)
- Remove base slug in permalinks of hierarchical custom post type
- Change custom post type slugs, with category/taxonomy before post type name
- Rewrite rules for custom posts types
- wp_list_categories() – current-cat class also inside posts?
- Custom Post Types, URL rewrite on multiple CPTs
- Adding custom post category slug in permalink causes 404 error for pages and posts
- How can I use get_post_meta with add_rewrite_rule to build custom permalinks?
- Index page with the same id as the slug
- Custom post type as home page with custom url
- How to rewrite url for any specific taxonomy?
- Custom post URL 404 error
- URL rewrite add author as base
- Set a CPT slug as a base name for all the taxonomies
- Custom taxonomy rewrite with query var returns %2F in URL
- Remove slug in URL custom post type
- cpt and page sharing same base permalink
- URL rewriting for CTP assigned entity
- CPT’s with landing page instead of archive – Url Rewrite?
- Added Custom Post Type and the View Option Doesn’t Work
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- Best way to specify “article type” in URL
- How to have permalink like domain.com/term/postname?
- post_type_link Filter – Too Few Arguments
- WordPress rewrite url
- url rewriting for custom post types
- Post type Permalink
- How to rewrite the post slug of a custom post type post
- Custom post type URL
- Add Custom Values to Permalinks Through Custom Fields and Posts
- Archive page for custom post type and custom taxonomy
- Why does my URL keep returning 404 error code?
- Custom Post Type nest under a normal WordPress Page
- Combine 2 different custom post slugs into a single permalink?
- Use a different URL path / permalink for CPT
- Add rewrite rule for custom post type single page
- Custom taxonomy terms as children of multiple custom post types
- Custom Post Type & Taxonomies – Rewrite
- Remove custom permalink base from CPT custom category and custom tags
- How to change URL for custom post type archive?
- How to handle this wordpress custom post type rewrite problem?
- Custom Post Type not using correct page template
- add_rewrite_rule wordpress ignoring url pattern, wp rewrite not working
- Rewrite of Custom Post Type doesn’t work with dynamic data
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- add_rewrite_tag broke permalinks that doesn’t use that specific tag
- How to use a custom post type as child of a particular post of another CPT?
- Custom URL for Custom Post Type & Custom Taxonomy Term
- Custom taxanomy and custom post type – pagination leads to 404
- Flush rewrite rules when new cpt is registred
- Custom post url in search.php isn’t the correct rewrited url
- I have a custom taxonomy assigned to two post types. How do I create URLs for different term archives for each post type?
- Custom WordPress URL
- Customizing the custom post type permalink
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Rewrite Rule & Regex – Extract ‘cat-name’ and ‘page-number’ from http://domain.com/custom-post-type/category/cat-name/page/page-number
- 2nd and 3rd Custom Post Type URL’s 404ing
- Custom Post Type – Rewrite slug [duplicate]
- Generate daily archive whenever any post type is added
- add_rewrite_rule not working in Custom Post Type UI Plugin
- Custom Post & Taxonomy rewrite break regular post & page
- Rewrite Rule for custom post type link with or without taxonomy terms
- Rewrite nested urls for custom post type
- Custom post type Premalinks main page and details page
- Rewrite rule taxonomy url with different values in one function
- Custom URLs between different post types, using “Pods”