Tag Info

Hot answers tagged

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.


2

Edit your existing code to exclude the index.php from redirecting like this: RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^/info/ RewriteCond %{REQUEST_URI} !^/index\.php$ RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,L] For an explanation, check the answer to this question: ...


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]'; ...


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/([^/]+)/([^/]+)/?$', ...



Only top voted, non community-wiki answers of a minimum length are eligible