0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WordPressのrewrite ruleいじるときのhook

Posted at

initだったりadmin_initだったりするけど、私はroot_rewrite_rules派です。


add_filter( 'root_rewrite_rules', function($rules){
	// ここでrurle設定する
     add_rewrite_rule("/hogehoge" , 'index.php?post_type=hogehoge' , 'top');
	return $rules;
}, 9999);

initは毎回走るのも重いし、admin_initは管理画面いじる人が複数いるとなぜか安定しなかった
いろんなタイミングでruleいじってたかもしれぬが
最近はこれ派です

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?