aserww106
aserww106

Reputation: 1341

check if rewrite rule exist

I created a new rewrite rules in wordpress and at first it runs correctly, and after a while (a few hours) it stop working, when I tried the url, it shows 404 page. My question is if I check the rewrite rules in init action use $wp_rewrite->wp_rewrite_rules();, will this cause performance issue?

Thanks!

Upvotes: 1

Views: 1623

Answers (2)

Obmerk Kronen
Obmerk Kronen

Reputation: 15949

More Info is needed ,

but try flush_rewrite_rules . extremely important especially with when dealing with CPT.

It is strange however that you see the changes only after a few hours . It should be immediate.

Upvotes: 2

Zac
Zac

Reputation: 1072

Wordpress rewrite rules are hard to debug, if you just search the rule you think is wrong. The reason is - it uses regular expression, not hard coded rules.

My suggestion is install plugin [rewrite-rules-inspector], then run you url in the plugin UI. It would give a better idea, which rule cause the problem.

Then, you can fix it add_filter('rewrite_rules_array', ...), either by remove old rules, or add new rules on top of the rules array; Remember, the top rule overwrites bottom rules.

Upvotes: 1

Related Questions