Tag Info

New answers tagged

0

pagename is for the page post type, if you are trying to pass the slug for the presskit post type, remove post_type and pagename and just set presskit=$matches[1] instead.


2

In order to add a parameter to all url of WordPress add_rewrite_endpoint() is more appropriate. I needed to add /foo after all URL so add_rewrite_endpoint("foo", EP_ALL); did the trick.


1

You had some errors in the regex that can make the rewrite rules. I don't know what "lists" or what kind of post you want to fetch, so I can not debug that, but this rewrite rule should be correct: add_action( 'init', 'add_rewrite_tags' ); function add_rewrite_tags() { add_rewrite_rule( '^lists/([^/]+)/([^/]+)/?$', ...


1

Try this. You also don't want to include $wp_rewrite->flush_rules() inside your function as that would flush on every page load. add_action('rewrite_rules_array', 'new_rewrite_rules'); function new_rewrite_rules($rules){ $newrules = array(); $newrules[ '^lists/([^/]*)/([^/]*)/?' = 'index.php?lists=$matches[1]&post=$matches[2]'; ...


0

after adding a new rule, you have to flush the rewrite-rules in order to use them that can be done with the "flush_rewrite_rules" function http://codex.wordpress.org/Function_Reference/flush_rewrite_rules or it can be done in going in the Administration Screens -> Settings -> Permalink and just saving without changing something on this screen



Top 50 recent answers are included