Remove special characters in a URL

http://www.example.com/ar/shop-listing/health-beauty~@/#$&&&%%$%3Cscript%3E/ In this particular URL, everything after the # (hash) is the fragment identifier and is not sent to the server by the browser, so cannot be blocked server-side in .htaccess. The server only sees: /ar/shop-listing/health-beauty~@/ If the # was to be removed from this URL then this would be a wholly invalid URL (because … Read more

Changing the search URL?

You can change the /search/ part to something else, like /topic/, but it will be harder to remove it completely, since that will conflict with WordPress Pages (is /banana/ a Page with the title “Banana” or is it the result page for the search term “Banana”?). To change the part, hook into the init action … Read more

url rewriting for most recent post

add_action( ‘init’, ‘ASHmostrecent_init’ ); function ASHmostrecent_init(){ add_rewrite_rule( ‘last/?$’, ‘index.php?post_type=post&posts_per_page=1′); } A query already pulls up posts starting from the latest to the oldest, so all you have to do is limit what’s returned by one. posts_per_page does this; limiting by one will give you the latest post. Edit the post_type accordingly.

Regionalised Content

I think you can create a rewrite rule for each “region” to don’t overwrite other important rules you could need (like pages, categories, etc..). I was playing with your code examples and with a small change in rewrite_resets could work: public function rewrite_resets() { global $wp_rewrite; foreach($this->ENABLED_POST_TYPES as $post_type) { $args = get_post_type_object($post_type); switch($post_type) { … Read more