When should add_rewrite_tag() be used?

The fundamental difference is: The add_rewrite_rule() adds a particular rule which is interpreted The add_rewrite_tag() adds a placeholder to use in url structures. This placeholder is then used to generate multiple rules. For instance – suppose you’re a travel agent advertising hotels in various countries. You may want a hotel’s url to be like www.example.com/hotels/UK/Balmoral … Read more

Need help with add_rewrite_rule

Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it’s not that hard to understand how it works. It is used to parse pretty URLs (/designers/) as if they were non-pretty (/index.php?pagename=designers). The basic idea is that you have a list of rewrite rules, regular expressions that can match the … Read more

How to create custom URL routes?

Add this to your theme’s functions.php, or put it in a plugin. add_action( ‘init’, ‘wpse26388_rewrites_init’ ); function wpse26388_rewrites_init(){ add_rewrite_rule( ‘properties/([0-9]+)/?$’, ‘index.php?pagename=properties&property_id=$matches[1]’, ‘top’ ); } add_filter( ‘query_vars’, ‘wpse26388_query_vars’ ); function wpse26388_query_vars( $query_vars ){ $query_vars[] = ‘property_id’; return $query_vars; } This adds a rewrite rule which directs requests to /properties/ with any combination of numbers following to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)