-
Notifications
You must be signed in to change notification settings - Fork 7
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
Some page URL lookups behaving strangely #14
Comments
That's strange, I had noticed this issue yesterday while testing it on a few dev sites, but it should be resolved. I'm so far unable to recreate the issue, even with a fresh install using nLingual + WooCommerce + TwentyTwenty. So far the home URL isn't redirected to the page's normal name, nor does the home link break on other pages. Can you give me an outline of what setup you're using? |
Haha, we have a pretty extreme plugin count and a lot of custom code, so it could well be some bad interaction there. This time I didn't reproduce with a fresh installation like I did the last time I bugged you, so it may just be our environment. I did confirm that it doesn't happen without nLingual enabled, and that it doesn't happen with 2.8.10. We are still on 5.4, not 5.5, [edit: of Wordpress, that is] if that matters or is known to cause problems, though I bumped to latest WooCommerce on our testing instance to see if that was the culprit (it wasn't). If I get a chance today I'll try to reproduce the issue on a fresh, blank 5.4 installation, and if the behavior crops up there I'll try going to 5.5 and see if that resolves it. If it doesn't show up in either case then I've got some digging to do, I guess. Thanks for checking it out. |
I don't think 5.5 has anything to do with it, though I'm wondering if it has something to do with the change I made to Regarding issue 2, it sounds like the link is in fact printing an empty string; can you confirm that the actual markup is printing the current page link. My next guess is that something is causing page_on_front to return 0/null and so get_permalink is simply using the current post's URL. I'll do some digging to see what could've changed that affects that. |
OK, here's what I just tried:
These show up as 302 redirects (from Then I tried setting Then, enabled proper permalinks in WP settings. Redirect still happens, but now to Disable nLingual, behavior reverts to default (no redirect). Now here's something odd:
This is all under theme Twenty Twenty (the default). So it does seem to be happening with vanilla WP, unless I've done something wrong here. HOWEVER I was not able to find a way to reproduce links intending to point at the homepage linking instead to the current page. I haven't dug far enough into Twenty Twenty's header code to tell how they're generating those links, yet. |
Okay that's just maddeningly strange. I'll do somet further testing tonight to see if I can recreate it. |
Just tried WP 5.5, same behavior. Under PHP 7.2 in both cases. Just bumped up to 7.4.9 just to cover all my bases. Same behavior. |
Quick & dirty docker-compose.yml I've been using to test, in case it's useful. You have to go through WP setup on first run, but as long as you don't rm the database container it shouldn't make you do that again. Just dropping nlingual in that mapped The WordPress is served on port 8090 with this file, unless you change it. |
Okay, got a docker instance spun up (holy crap I need to start using this more), and was able to recreate the issue. Digging into the cause now but as far as the |
Right, I get that Let me know if I can do anything else to help out. Thanks a bunch for looking at this. |
Okay I found the culprit: nlingual/includes/class-nlingual-frontend.php Line 468 in cea14b1
When I rewrote the It's fixed now, as for the other issue with the homepage links pointing to the current page, not sure what could be happening there but might be tangentally related to |
Just tried out Quickly kicked the tires on client language preference redirection and that still seems to be good, no regression. Awesome. Thanks again. |
Sweet. Thanks for all the detailed info, really appreciate it. |
Version: 2.9.0
Situation:
Site uses a page as its homepage (the URL of which is typically retrievable with
get_option('page_on_front')
). This happens to be named "desktop", in this case. Without nLingual, and under nLingual 2.8.10, this resolves simply toexample.com/
with no page slug. Under nLingual, the home page is redirected toexample.com/desktop/
, andget_option('page_on_front')
not only returns thatdesktop/
path while on the homepage, but proceeds to return whatever the current page is, as one nagivates around the site, such that a link that would normally always point at the homepage (simply,example.com/
) points instead to, say,example.com/some-page
while visitingsome-page
.So there seem to be two things going on, that are different from behavior under vanilla WP or nLingual 2.8.10:
example.com
, end up onexample.com/desktop
)page_on_front
option, and ends up providing the current page path for some reason.The first is just undesirable, but the second actually breaks things.
Possibly relatedly, I'm also seeing page URL lookups built into WooCommerce, for things like the cart or checkout URLs, return a link to the site root instead, with the result that these links are non-functional with nLingual 2.9.0 enabled. There seems generally to be something odd happening with internal WordPress page URL lookups, though not with lookups for the purposes of request routing, as far as I can tell (if you put the URLs in manually, they work).
(It may be premature to report bugs in 2.9.0 since it's not up on the plugin market yet, but given the version bump on master I thought it safe to at least try out; if you already knew or suspected it has issues of this sort and aren't ready for anyone to be messing with it, I'll take no offense at a fast close on this issue)
The text was updated successfully, but these errors were encountered: