Create custom permalink for custom post type
-
Hi,
I want to create custom permalink for my custom post type. The url for single post should be site_url/post_slug/meta_value/meta_value/post_name , where meta_value is custom filed for city and service and its working fine. but it redirecting to 404 page as I have created a single page template (single-constructor-your_city-your_service.php). If I use only one meta value in slug and also template name having one meta_value then its showing the correct page.Please check my rewrite rule for the above slug
add_filter( ‘rewrite_rules_array’, ‘my_rewrite_rules_array_services’);
function my_rewrite_rules_array_services($rules) {
$rules = array(‘services/([^/]*)/([^/]*)/?$’ => ‘index.php?post_type=contractor&name=$matches[3]&meta=$matches[1]&meta=$matches[2]’) + $rules;
return $rules;
}Please let me know what wrong I am doing.
Thanks!
-
-
Please check my CPT url
http://findingutah.websiteque.com/services/sandy/drywall/big-tims-plumbing/ -
Hi there,
Your site is using WordPress.org software which is hosted on another host.
Name Servers :
ALGIN.NS.CLOUDFLARE.COM
CANDY.NS.CLOUDFLARE.COMWordPress.com forum helps the sites hosted on WordPress.com only.
You can post your question in WordPress.org forum:
https://wordpress.org/support/forum/miscellaneous/#new-postFor more information here is the support documentation link below:
https://codex.wordpress.org/Read the difference between .com and .org
Hope this helps .
Thanks!
- The topic ‘Create custom permalink for custom post type’ is closed to new replies.