Home>Support>Strange problem with PageBuilder + Polylang [+WooCommerce]

Strange problem with PageBuilder + Polylang [+WooCommerce]

Hi,
I have a very strange and anoying problem.
My site is using PageBuilder, Polylang and now WooCommerce (and others plugins).

Everything is working perfectly if I disable PageBuilder, except the layout is broken.

When PageBuilder is enabled, Polylang is not able to display the localized WooCommerce single product page, I get a “That page can’t be found.” error.

More precisely, I can have the website working with those 3 plugins if I enable them one by one then browse the site. However, as soon as the rewrite rules are flushed (for exemple, if Save Changes from the Permalinks settings, or if another plugin flush the rules), the website no not display the localized product anymore. I have the exact same problem with any other custom taxonomies (not only with WC’s products). For example, http://www.davidbriard.com/fr/city/paris-fr/ (City is a custom tax of media) will not work either after the rules are flushed.

If I print_r($wp_rewrite->rules), I can see that all the lines starting by “[(fr)/product/…” are gone.

More over, if I print_r($query->query_vars) in pre_get_posts, I have those two case:

When it works

Array
(
    [page] =>
    [product] => print-eiffel-tower
    [post_type] => product
    [name] => print-eiffel-tower
    [attachment] =>

When it DON’T works

Array
(
    [attachment] => tirage-tour-eiffel

I found nothing in your code about rewrite rules so I can’t understand why polylang affect the polylang rewrite rules.

However, PageBuilder seems to do something with queries. May be this is why the custom taxonomies pages are reported to be not found?

This problem is now really blocking as I would like to use another plugin (Hyyan WooCoommerce Polylang Integration), and now my disable/reactivate Polylang workaround do not work anymore :(

Are you aware of this problem?
Have you any suggestion how to modify PageBuilder to resolve that issue?

Thanks in advance for any help!
Best regards,

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 7 days ago David Briard

    Hi,
    I’ve found where the problem is and a workaround.

    in polylang/include/links-permalinks.php, there is this function:

    public function get_rewrite_rules_filters() {
    		// make sure we have the right post types and taxonomies
    		$types = array_values(array_merge($this->model->get_translated_post_types(), $this->model->get_translated_taxonomies(), $this->model->get_filtered_taxonomies()));
    		$types = array_merge($this->always_rewrite, $types);
    		return apply_filters('pll_rewrite_rules', $types); // allow plugins to add rewrite rules to the language filter
    	}
    

    When PageBuilder is disabled:

    get_translated_post_types returns:
    Array
    (
        [post] => post
        [page] => page
        [attachement] => attachment
        [0] => product
        [1] => cookielawinfo
    )
    
    get_translated_taxonomies returns:
    Array
    (
        [category] => category
        [post_tag] => post_tag
        [0] => product_cat
        [1] => product_tag
        [2] => product_shipping_class
        [3] => pa_print-size
        [4] => pa_finish
        [5] => city
        [6] => country
        [7] => camera
        [8] => lens
        [9] => region
        [10] => location
        [11] => aspect
        [12] => treatment
        [13] => keyword
    )
    
    get_filtered_taxonomies returns:
    Array
    (
        [post_format] => post_format
    )
    

    When it is enabled:

    get_translated_post_types returns:
    Array
    (
        [post] => post
        [page] => page
        [attachement] => attachment
    )
    
    get_translated_taxonomies returns:
    Array
    (
        [category] => category
        [post_tag] => post_tag
    )
    
    get_filtered_taxonomies returns:
    Array
    (
        [post_format] => post_format
    )

    My workaround is to add the missing types in function.php of my theme

    function fix_rewrite_rules($types) {
    	$force_rewrite = array('product', 'country', 'aspect', ...);
    	$types = array_merge($force_rewrite, $types);
    	return $types;
    }
    if (function_exists('pll_get_post')) {
    add_action( 'pll_rewrite_rules', 'fix_rewrite_rules');
    }

    Do you know if it is a problem related to Polylang or PageBuilder?
    If PB, iIs this something that you can fix in the next release?

    Best regards,

  2. 7 years, 6 days ago Andrew Misplon Hi, I Work Here

    Hi David

    Thanks so much for reporting this.

    We weren’t aware of the issue. Polylang is our “go to” free translation plugin for Page Builder so this is important.

    This thread is really clear and well laid out, thanks for that. Let me chat to Greg about the issue and come back to you with some feedback.

  3. 7 years, 3 days ago David Briard

    Thank you :)

  4. 7 years, 3 days ago Andrew Misplon Hi, I Work Here

    Could you perhaps confirm the plugin you’re using to bridge WooCommerce and Polylang. They don’t appear to work together by default.

    I seemed to have good results with:

    Hyyan WooCommerce Polylang Integration Plugin

  5. 7 years, 3 days ago David Briard

    I now use “Hyyan WooCommerce Polylang Integration” which allow to synchronize the custom fields between localized product and localized product attributes.

    However this bug is not related to this plugin.
    It is not related to WooCommerce too, as I also have the bug with my custom taxonomies (created with Types plugin).

    Here a quick test you can do to see if you can reproduce the bug:

    1. Install and configure WooCommerce, Polylang, PageBuilder, create an english (default lang) product, then localize it to french for example.
    2. Disable all plugins.
    3. Activate only WC, Polylang, and PageBuilder.
    4. Try to view the localized (french) product. I get a page not found.
    5. Disable Polylang.
    6. Activate Polylang.
    7. The localized product page is OK
    8. Either Save permalinks, or go to polylang settings and save string translation.
    9. The localized product page display page not found error.
    10. Disable PageBuilder.
    11. Everything works as expected. I have no bug anymore.

    Without Hyann’s plugin, my workaround was to deactivate then reactivate Polylang, but with Hyann’s plugin, this workaround do not work anymore, I don’t know why…

    I hope you can reproduce this bug.

  6. 6 years, 2 months ago Sébastien Méric

    Hi,

    If it’s of any use to anyone, it seems that the problem is still the same and that your workaround, David, is still the right answer untill something is implemented in polylang…

    Tested with :
    WP version : 4.5
    Polylang version : 1.8.5
    Woocommerce version : 2.5.5
    Hyyan WooCommerce Polylang Integration version : 0.25

    Regards,

    Séb.

  7. 6 years, 2 months ago Sébastien Méric

    Sorry, i forgot :

    Page Builder by SiteOrigin verion : 2.4.6

    Séb.

  8. 6 years, 2 months ago [email protected]

    Hi,
    Same problem !
    Wordpress version 4.4 (latest version not compatible with theme)
    theme accesspress parallax pro
    polylang v 1.8.5 (latest version)
    page builder v 2.4.6 (latest version)

    Portfolio links to foreign languages : 404 error, excepted if desactivating page builder plugin, which is not satisfactory at all !

    Looking on various forums many users report some incompatibility between Polylang and Page Builder by site origin but could not trace any issue. (unsuccessfully tried to add David Briard hack to my theme function.php file)

    Please help !!!

    By the way, some people report that using Page Builder version 2.0.4 would solve the problem, but could not find this older version

    Anticipated Tks

    Best regards

  9. 5 years, 11 months ago micaurbina

    Hi,

    I’m having the same issue with Polylang + Woocommerce + PageBuilder, everything works great, except when I click on any product, I get a “page not found” error.

    Did you ever find a solution for this?

    Thanks!
    Mica.

  10. 5 years, 10 months ago MadMatter

    Also same issue here,

    WP Version: 4.6
    Polylang: by Frédéric Demarle – 2.0.3
    Page Builder by SiteOrigin: by SiteOrigin – 2.4.13
    SiteOrigin Widgets Bundle: by SiteOrigin – 1.6.5
    Hyyan WooCommerce Polylang Integration: by Hyyan Abo Fakher – 0.27
    WooCommerce: by WooThemes – 2.6.4

    Hack from David Briard would crash my site and until I remove it again from function.php via ftp.

    Would also be happy about some solution.

  11. 5 years, 10 months ago xaifu

    Hi there!

    I’ve found this issue in my wordpress instalation.
    WP 4.6
    WooCommerce 2.6.4
    Polylang 2.0.3
    Page Builder por SiteOrigin 2.4.13
    Toolset Types 2.2.1

    If I try to edit a blog post I get a page not found error. If I disable Page Builder I can edit the post.
    I have some pages where I use page builder for the layout and I could’t edit them as I get a page not found error. I disabled Types and I was able to edit the content of the pages.

    I hope this can help to anyone.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More