Tag Info

New answers tagged

0

By default, W3 Total Cache (and many alternative caching plugins) prevent caching when you're logged in (specifically for the admin account), which is the reason you'll always see fresh content or the latest changes made when you're logged in, but not when you're logged out. The exception to this would be if you're using a CDN as the CDN would need to be ...


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.


0

You could use 2 of Wordpress' built in functions to get the result you're after. add_rewrite_tag() and add_rewrite_rule() There is an example of how to use these tags to get the result you want about halfway down this page https://codex.wordpress.org/Rewrite_API/add_rewrite_rule. Note: remember to flush your rewrite rules.


0

Just in case someone reads this after all this time (2011): I ran into the same issue, and after reading many posts, get back to my WP, and 'voila !' : It was working as expected ! this is a cache issue IMHO (WP 4.2.2). Cheers.


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



Top 50 recent answers are included