-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slugs: child of hierarchical pages gives 404 #1180
Comments
I noticed there's a If i replace the two WP calls with
Unfortunately this doesn't solve the issue. It's quite unclear what the |
@herrvigg result from WP |
If I set |
The problem is happening in Line 236-251
The match looks correct, but not the query. It doesn't pick the correct one.
Can you track back which query you get in your case? |
I suspect a problem with the check on |
Before the query with attachment, there's this one coming:
There's a call to |
@bagaweb To understand if your issue is the same, could you add these two lines in file
|
|
In slugs What |
If you mean
After the filter is applied:
which is the expected value. Hence the thing seems to rely on that filter. |
OK I think I start to understand how slugs works... it's an absolute hack through WP state before
State after query_vars filter (hacked by slugs)
But after that the Finally the
The query_vars no longer matches the matched_query that was hacked by slugs. |
What is surprising, in your case your WP context before query_vars is different, in your case
In my case
The problem is that this "attachment" match comes back later in the query vars. |
Still I don't understand how this is matched by the regex in the first place.
In the old plugin |
It's a valid match after going through all the rewrite rules.
In that case
In your case, it's because it doesn't find a valid match that the context hacked by slugs is valid... |
In my case there are 97 rewrites rules
It seems you don't have that one with the attachment. I don't know where it comes from. |
ok let me try to improve this |
This attachment is also checked in WP
An idea could be to create attachments for the slugs, for every language. But that would require more updates in DB when the slugs are saved. |
Potentially this could also be interesting to avoid many hacks with the |
In principle you can reproduce the problem if you add this rewrite rule (at any place since you have a 404 first in WP but not in slugs):
|
For @bagaweb it could be something similar, or some problem with a cache. I also realized there's another internal WP cache for the posts, used in
Saving the post again would invalidate that WP cache I guess (supposedly updating the cache key for that group). |
Yes, it works (after migration). No need for a pull request. Once we're happy with the branch I can merge it and link it to this issue #1180. |
If the |
|
I think this will also cover a number of conflicts we are not seeing now... |
I came up with this fix 9036c6a in branch https://github.com/qtranslate/qtranslate-xt/tree/fix-slugs-query-vars. The idea is to filter the If some other plugin alter the query vars after QTX/slugs, it may be a problem, but I don't think this should happen. |
I suspect someone in the past had an idea to do some cleanup in the
But it was not the case until now as |
I don't know if this affects
Let me know if this fix works on your side. |
This is not working for me. |
EDIT: my bad, wrong test url. |
Yes this should not be needed anymore. it's same kind of conflict as |
Some rewrite rules cause conflicts in slugs due to perma query vars. Update the query vars returned by `query_vars` filter: - purge the query vars from the matched query before slugs - but, keep the new query vars from the matched query found by slugs. Remove previous workaround for `name` var in `filter_request` (page). Update doc.
Merged in master. |
Some rewrite rules cause conflicts in slugs due to perma query vars. Update the query vars returned by `query_vars` filter: - purge the query vars from the matched query before slugs - but, keep the new query vars from the matched query found by slugs. Remove previous workaround for `name` var in `filter_request` (page). Update doc.
Please can you try again on master directly, to be sure? The new patch is slightly different, but it's the same idea. It would be interesting to see which rewrite rule you had. I still don't understand how the regression is related to the migration though... but what matters is that it's solved for all. |
I tried again latest master and evertything seems to be working fine! |
Sounds great! Finally we are about to release this version. Just a curiosity, to try understanding what the problem was in your case, could you add these var dumps after line 307 in `modules/slugs/slugs-class-slugs?
|
Ok I added those lines and tried on a child page, this is the result:
|
Thanks for all the hard work ! |
OK this looks like the problem I had, a WP match with Anyway, we can close this issue. |
@spleen1981 I tested with a couple of parent-child pages to try debugging the problems after QTS migration encountered by @bagaweb. However even before migration, with commit 3a54f9e I don't manage to make it work:
localhost://h1-en/
localhost://h1-en/h2-en/
😕localhost://h2-en/
The pages were created with EN titles
hierarchical parent EN
/hierarchical child EN
and equivalent for FR.I set only the slugs for EN and FR, the other languages inherited automatic slugs as shown below. All look fine from the admin side.
With a breakpoint in
filter_request
I get this in the resulting$query
for the/h1-en/h2-en/
request:The languages URL seem to be correctly set in
This looks pretty good, but I'm not sure about the pagename in the query.
Where to look next?
The text was updated successfully, but these errors were encountered: