Blog List Page 404 With Custom Post Type Rewriting to Blog Parent
Blog List Page 404 With Custom Post Type Rewriting to Blog Parent
Blog List Page 404 With Custom Post Type Rewriting to Blog Parent
Get the custom post type slug but remove the rewrite prefix?
Found the solution! I was trying to over complicate things. The best method I’ve come up with is: $users=get_page_by_title(‘users’); $about=get_page_by_title(‘about’); add_rewrite_rule(‘^users/([^/]*)$’,’index.php?page_id=’.$users->ID.’&username=$matches[1]’,’top’); add_rewrite_rule(‘^users/([^/]*)/about/?’,’index.php?page_id=’.$about->ID.’&username=$matches[1]’,’top’); Haven’t come up with errors yet, haven’t tested yet!
You’ve got it the wrong way round – WordPress won’t rewrite (redirect) your query string (known as canonicalization), but it will pass your parameters through if you use the rewritten URL: http://example.com/test/information/people Now if you print_r( $wp-query_vars ) in your template, you should get something like: Array ( [pagename] => test [information] => people ) … Read more
you can remove this functionality by adding this code in a plugin or theme remove_action( ‘template_redirect’, ‘wp_redirect_admin_locations’, 1000 ); This will remove all of dashboar, login, admin so if you will want some of them to still be there you will have to write your own replacement function to wp_redirect_admin_locations and hook it after you … Read more
Found that solution useful I think, this is an expensive way to replace underscores with dashes. But this works at least in my test environment. The first rule replaces dashes one by one. The second rule then removes the prefix from the requested URL. RewriteBase / # replace underscores with dashes RewriteRule (.+?)_(.+) $1-$2 [R=302,L] … Read more
Internal rewrite rules should all point to index.php. You also need to set the proper query vars so that the main query can successfully run, in this case, to query for your detail page. add_rewrite_rule( ‘detail/([^/]*)/([^/]*)/?$’, ‘index.php?pagename=detail&value1=$matches[1]&value2=$matches[2]’, ‘top’ );
Connect custom rewrite rules and query variables to wordpress navigation
add_rewrite_rule using custom taxonomy and year
Paging not working for hierarchical custom post type