• Resolved shamotj

    (@shamotj)


    When using Woocomerce and redirect is post_type=product, then redirect is stored as post ID. But redirect happens BEFORE Woocommerce registers post_type. So if will redirect to http://www.domain.com/?p=ID. It can be resolved by setting priority from 1 to 6 in eps-301-redirects.php on line 86. But I don’t know if this won’t affect other redirects.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Alexandru Tapuleasa

    (@talextech)

    Hi,

    Can you give me an example of a From / To redirect?

    Thread Starter shamotj

    (@shamotj)

    Well From doesn’t matter much, it can be anything and To must be any product ID. It falls to get_permalink function on line 518 in eps-301-redirects.php. get_permalink() is in wc-includes/link-template.php and it should return product URL on line 201, but it fails because product is not yet defined as post_type due to priority 1 (Woocommerce has set priority 5 to register_post_type).

    Plugin Author Alexandru Tapuleasa

    (@talextech)

    I see, I will add it to our ToDo list to see if we can do something about it and fix it in a future update. Just changing the priority is not an option as by now a lot of people are using it and it could break other things for other people 🙁

    In PRO we have an option to run on either init or template_redirect but if your solution works for your website that should be fine as well 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bug with Woocommerce products’ is closed to new replies.