Get rewrite slug of custom post type in template
You can access the post type properties using get_post_type_object(). The rewrite argument will be a property if the returned object: $post_type_object = get_post_type_object( ‘products’ ); $rewrite_slug = $post_type_object->rewrite[‘slug’]; Update I needed this for permalinks inside a template part where there are categories displayed. No you don’t. To get the URL to a category archive, use … Read more