Custom Post and Query Variable – name conflict
-
I have been using a query variable called ‘walk’ in URLs for several months as in for example:
www.mydomain/?page_id=123&walk=My+Walk
whhich has been working perfectly.Last week I added a custom post type with:
function register_walk_post_type() { $labels = array( 'name' => 'Walks', 'singular_name' => 'Walk', ... ); $args = array( 'labels' => $labels, ... ); register_post_type( 'walk', $args ); } add_action( 'init', 'register_walk_post_type' );
i.e. the custom post type name was also ‘walk’, and earlier today found that none of the pages using the query variable ‘walk’ would load in a browser, the PHP file handling the query variable was not executed and ‘page not found’ was displayed. It took me several hours to discover this and some tedious editing to change the query variable name throughout the site – this solved the problem.
Is there some other way round the problem or is it a rule that custom post type names and query variable names must be different. If so is that mentioned somewhere in the documentation? A search failed to find anything.
- The topic ‘Custom Post and Query Variable – name conflict’ is closed to new replies.