Custom Struct for Custom Post Type
-
I’m running an event’s blog and I want to have custom permalink structure for just these post types. Rather than having http://url.com/post-type/post-name i want to have my permalinks as http://url.com/author/event/post-name.
add_action('init', 'gs_rewrite_rule'); function gs_rewrite_rule(){ $perm_structure = '/%author%/%ln_group_sessions%'; add_rewrite_tag("%ln_group_sessions%", '([^/]*)', "ln_group_sessions="); add_permastruct('ln_group_sessions', $perm_structure, false); add_rewrite_rule('event\/([^\/]+)\/', 'index.php?ln_group_sessions=$matches[1]', 'top'); }
I’ve tried a ton of plugins and other solutions, of which this is the latest. I can have the permalinks registered and changed throughout the admin but once I try to visit I’m getting 404’s.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Struct for Custom Post Type’ is closed to new replies.