I have a post-meta field for Neighborhood. I want to setup a url like: url.com/neighborhood/NEIGHBORHOOD-NAME

I know this would typically be handled by a CPT or custom taxonomy but it has to be done with a post-meta field in this case.

I also want this to use a custom template, not one of the standard templates.

I can easily link to the url but it returns a 404 page because nothing is associated with it.

Wordpress doesn't know what content to grab. Any ideas?

1 Answer 1


There's the core function add_*/get_query_arg() that you can use to append stuff to the query and retrieve it.

So simply add a link somewhere, that points to your custom post types single.php template


Then append the query arg which would be ?wpse_meta_key=wpse_some_val and then do a switch on top of your template:

if ( 'wpse_some_val' === get_query_arg( 'wpse_meta_key' ) )
    get_template_part( 'special_query_template' );
    // do default stuff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.