anspress icon indicating copy to clipboard operation
anspress copied to clipboard

Change rewrite rules order

Open Pierre-Lannoy opened this issue 8 years ago • 7 comments

Rewrite rules must be ordered from the most specific to the least specific. Rather than adding the rules at the end of the array, you must add them at the beginning. This way they will be executed before more generic rules. Note: if somenone use ap_rewrites filter to adapt rules to Polylang with lang prefix in urls, it is mandatory to do this way...

Pierre-Lannoy avatar Dec 16 '17 13:12 Pierre-Lannoy

Thanks for the patch. In previous version of AnsPress it was exactly like you have suggested. But I have to do this hack to prevent issue with third party plugins. Also all on 404, its redirected to AnsPress page. I will check whether this patch does not reproduce the old bugs.

rahularyan avatar Dec 16 '17 13:12 rahularyan

I must admit I have not tested it with so many plugin. I've done test mainly with plugins which have their own r/rules and custom post types (like around twenty plugins) but you're right, I can't cover all the cases. Maybe would it be helpfull to have a setting to switch on/off this?

Pierre-Lannoy avatar Dec 16 '17 14:12 Pierre-Lannoy

Please describe your test case where it is failing. I will see if I can do something about it.


From: [email protected] [email protected] on behalf of Pierre-Lannoy [email protected] Sent: Saturday, December 16, 2017 8:05 PM To: anspress/anspress Cc: Subscribed Subject: Re: [anspress/anspress] Change rewrite rules order (#378)

I must admit I have not tested it with so many plugin. I've done test mainly with plugins which have their own r/rules and custom post types (like around twenty plugins) but you're right, I can't cover all the cases. Maybe would it be helpfull to have a setting to switch on/off this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/anspress/anspress/pull/378#issuecomment-352187159, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMwTpVbw3bl8eKWI54CTHPz2i582HITPks5tA9U1gaJpZM4REVVf.

geetikaaryan avatar Dec 16 '17 14:12 geetikaaryan

Sorry, I doesn't understand. I haven't test cases where it fails. I've tested the proposed pull request with around twenty plugins in a fresh WP install and all is good. Which test are you talking about?

Pierre-Lannoy avatar Dec 16 '17 14:12 Pierre-Lannoy

I mean do you have any issues with current rewrite rules injection method? Or your patch is just a "coding standard" fix?


From: Pierre-Lannoy [email protected] Sent: Saturday, December 16, 2017 8:12 PM To: anspress/anspress Cc: Subscribed Subject: Re: [anspress/anspress] Change rewrite rules order (#378)

Sorry, I doesn't understand. I haven't test cases where it fails. I've tested the proposed pull request with around twenty plugins in a fresh WP install and all is good. Which test are you talking about?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/anspress/anspress/pull/378#issuecomment-352187602, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AL2KuqtevjPmpWRKdNX4NHMpJdpw-QRJks5tA9begaJpZM4REVVf.

JonathanM2 avatar Dec 16 '17 14:12 JonathanM2

Hello. I have no issue with the plugin, nor this is a coding standard fix. It's a way to permits other plugins or themes to use ap_rewrites filter without errors, especially in the case of using Polylang which necessitates a consequent modification of the r/rules. Anspress have issue only when you're using this filter because rules are not correctly ordered (r/rules are a nightmare with WordPress, I know ;)). Anyway, the best approach would be Anspress natively supports all Polylang/WPML url modes, but this pull request is a quick (and not dirty) fix to do it just via the ap_rewrites filter...

Pierre-Lannoy avatar Dec 16 '17 17:12 Pierre-Lannoy

I got it 😊. I will try with polylang and wpml and make AnsPress work with those plugin without any hack. Thanks


From: [email protected] [email protected] on behalf of Pierre-Lannoy [email protected] Sent: Saturday, December 16, 2017 11:18 PM To: anspress/anspress Cc: Geetika Aryan; Comment Subject: Re: [anspress/anspress] Change rewrite rules order (#378)

Hello. I have no issue with the plugin, nor this is a coding standard fix. It's a way to permits other plugins or themes to use ap_rewrites filter without errors, especially in the case of using Polylang which necessitates a consequent modification of the r/rules. Anspress have issue only when you're using this filter because rules are not correctly ordered (r/rules are a nightmare with WordPress, I know ;)). Anyway, the best approach would be Anspress natively supports all Polylang/WPML url modes, but this pull request is a quick (and not dirty) fix to do it just via the ap_rewrites filter...

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/anspress/anspress/pull/378#issuecomment-352198934, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMwTpQVvbVqFAHtHSUaCHDHUBMYPu0Avks5tBAJPgaJpZM4REVVf.

geetikaaryan avatar Dec 17 '17 02:12 geetikaaryan