Skip to content
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

Cater for non-permalinks URLs eg https://example.com/?p=39 #5

Open
bobbingwide opened this issue Oct 28, 2021 · 3 comments
Open

Cater for non-permalinks URLs eg https://example.com/?p=39 #5

bobbingwide opened this issue Oct 28, 2021 · 3 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Oct 28, 2021

Initially I didn't think it was necessary to support requests for a particular post ID but I discovered that it's necessary to detect when parameters are being passed to the URL since this affects the processing.

The requirement is to detect query params to deal with them differently

URL Means
https://example.com/ display the home page
https://example.com/?p=39 display the post with post ID 39

Example scenario

  • website: denisethatcher.com
  • uses: WooCommerce
  • if we deactivate WooCommerce on the home page then the link changes from https://denisethatcher.com/product/denise-thatcher-invades-britain/ to https://denisethatcher.com/?p=39
  • Visiting this link leads to a 404

Aside: The [add_to_cart] shortcode doesn't work either but that's a separate issue to be addressed.

Possible workaround

  • Register the product Custom Post Type using oik-types

Possible solution

  • Add support for query parm detection. If the query parm is p=nn or page=nnn or even preview=nnn then don't treat this is a request for the home URL but find the URL using the ID.
@bobbingwide bobbingwide added bug Something isn't working enhancement New feature or request labels Oct 28, 2021
@bobbingwide bobbingwide self-assigned this Oct 28, 2021
@bobbingwide bobbingwide changed the title Cater for non-permalinks URLs eg https://example.com/?p=29 Cater for non-permalinks URLs eg https://example.com/?p=39 Oct 28, 2021
@bobbingwide
Copy link
Owner Author

Aside: The [add_to_cart] shortcode doesn't work either but that's a separate issue to be addressed.

Additionally; the output from the shortcode had been disabled; hidden by CSS, 8 years ago. Don't ask me why!

@bobbingwide
Copy link
Owner Author

bobbingwide commented Nov 28, 2021

There's also a problem when the request is like https://ebps.co.uk/?post_type=tribe_events
This gets treated as https://ebps.co.uk/
Workaround: Change the URL to https://ebps.co.uk/events

Other menu items may not be processed due to taxonomies not being registered either.
Workaround

@bobbingwide
Copy link
Owner Author

bobbingwide commented Mar 24, 2022

The logic also causes a major problem with requests such as:

https://example.com/?wc-ajax=update_order_review
https://example.com/?wc-ajax=checkout

This is a major problem with WooCommerce sites, if you unload WooCommerce on the home URL.

  • It prevents WooCommerce from responding to these requests.
  • They're supposed to return some JSON.
  • When WooCommerce is deactivated the result returned to the browser is the HTML for the home page.
  • This isn't expected by WooCommerce's checkout.js
  • It never enables the Place order button.

Workaround

  • Don't deactivate WooCommerce on the home page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant