WordPress keeps writing rewrite rules to .htaccess

I am not sure why this happens, but you can stop all write access to your .htaccess with a simple filter: add_filter( ‘flush_rewrite_rules_hard’, ‘__return_false’ ); Neither WordPress nor any plugins calling flush_rewrite_rules() will write something into the file now. Other methods to access and change the file will still work, for example insert_with_markers().

URL redirect on updating the post date

You could try redirecting without a plugin, using the .htaccess file. This file can be found at wordpress root folder, if all you want to do is redirect this specific page, you could open and insert the following line (at the first line of the .htaccess) Redirect 301 /2014/02/20/events-2014/ http://www.example.com/2014/03/02/events-2014/

URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”

I used the following functions to solve this problem. //This adds a custom query variable to the permalink function add_custom_query_var( $vars ){ $vars[] = “shop_name”; return $vars; } add_filter( ‘query_vars’, ‘add_custom_query_var’ ); function add_rewrite_rules($aRules) { $aNewRules = array(‘shop/([^/]+)/?$’ => ‘index.php?pagename=shop&shop_name=$matches[1]’); $aNewRules2 = array(‘shop/([^/]+)/gallery/?$’ => ‘index.php?post_type=gallery’); $aRules = $aNewRules + $aNewRules2 + $aRules; return $aRules; } … Read more