Custom post types and custom variables — add_rewrite_tag() question
function add_places_rewrite_tags() { add_rewrite_tag(‘%action%’,'([^&]+)’); } add_action( ‘init’, ‘add_places_rewrite_tags’ ); First add the rewrite tag action (action=xxxx) function add_places_rewrite_rules() { add_rewrite_rule(‘^area/([^/]*)/places/?’,’index.php?post_type=area&name=$matches[1]&action=places’,’top’); add_rewrite_rule(‘^area/([^/]*)/([^/]*)/places/?’,’index.php?post_type=area&name=$matches[2]&action=places’,’top’); } add_action( ‘init’, ‘add_places_rewrite_rules’ ); Then add a custom rewrite rule. (post_type=area may be different if you made a custom slug for the posttype, use the posttype name). Remember to flush your rewrite rules … Read more