Tag Info

New answers tagged

1

The short answer is: that's not how rewrite rules work. You can see how they work in the examples section of the codex page. It sounds like what you're trying to do is setup a redirect. I would suggest using a plugin to do that.


0

You rewrite rule is quite board and it will, for sure, generates a lot of conflicts. add_action('init', 'dcc_rewrite_tags'); function dcc_rewrite_tags() { add_rewrite_tag('%propref%', '([^&]+)'); } add_action('init', 'dcc_rewrite_rules'); function dcc_rewrite_rules() { ...


0

The problem with calling flush_rewrite_rules() is that the rules instantly get regenerated, while your plugin's hooks are still active. What I usually do, because it's the simplest route to success, is delete the rewrite_rules option on activation/deactivation. The rules will then get regenerated on the next pageload instead of the current one: ...


1

You can create a posts archive by just setting post_type=post in your rewrite rule: function custom_archive_rule() { add_rewrite_rule( 'custom-archive/?', 'index.php?post_type=post', 'top' ); } add_action( 'init', 'custom_archive_rule' ); WordPress will identify this as is_home, so you'll have to target it in pre_get_posts ...



Top 50 recent answers are included