Tag Info

New answers tagged

0

I found the solution just after posting here. Here is the codex: http://codex.wordpress.org/User:Amereservant/Editing_and_Customizing_htaccess_Indirectly And this is the code I was looking for: function my_htaccess_contents( $rules ) { $my_content = <<<EOD \n # BEGIN My Added Content # Protect wpconfig.php <Files wp-config.php> Order ...


2

Yes, you should flush rewrite rules in this case, because you add rules for every author based on his nicename. To be more precise, you should flush them after any author changes his nicename also. And you do this using author_rewrite_rules hook, which is fired in wp_rewrite_rules() only when there are no rules in database. So without flushing them your ...


1

There might be better ways using filters or apache/nginx rewrites, but here are two ideas to consider from the admin UI point of view (untested): Idea 1: You can always visit /wp-admin/options-general.php change the whole the site url: but I don't think you're looking for that, since this will also change the home url. Idea 2: You might therefore ...


1

From performance point of view what takes time is matching URL against generated (and stored persistently so it's not rebuilt continuously) list of regular expressions. Since URLs are (most of the time) insignificantly short in text volume the amount of those regular expression rules has most impact on performance. Unless you generate unreasonably many ...


0

You don't need to specify a pagename, if you want to replicate a post type archive set post_type instead. function add_events_rewrite_rules(){ add_rewrite_rule( 'events/date/([^/]+)/?$', 'index.php?post_type=events&_events_date=$matches[1]', 'top' ); } add_action( 'init', 'add_events_rewrite_rules' );


0

I simply changed it to this, and it works! add_action( 'init', 'addMyRules' ); function addMyRules(){ add_rewrite_rule('^people/([^/]*)/?','index.php?author_name=$matches[1]','top'); add_rewrite_tag('%author_name%','([^&]+)'); flush_rewrite_rules(); }


1

Instead of index.php/reco/?b=$1, try this: "$wp_rewrite->index?pagename=reco&b=" . $wp_rewrite->preg_index( 1 ) You should also append a $ to your reco/([^/]*)/? regex to ensure the rule only matches the entire path, and not just the beginning. Then flush your rules afterwards (just re-save your permalink settings in admin). Update: Try using ...



Top 50 recent answers are included