Support

Account

Home Forums Bug Reports Incompatibility with Polylang

Solved

Incompatibility with Polylang

  • Hi,
    I recently stumbled upon an incompatibility bug of ACF with the multi-language plugin “Polylang”(http://wordpress.org/plugins/polylang/).
    By using a relationship-field the posts didn’t appear anymore. I was able to identify the origin of the bug with the help of Firebug: ACF was not able to fetch the AJAX results, because there was a PHP-error thrown.
    The error message pointed to /advanced-custom-fields/core/fields:173, where ACF provides support for WPML. At the moment this line only checks the existence of $options[‘lang’] and tries to run a method of $sitepress. The problem is that Polylang seems to use the same option. It would be sufficient to just check if $sitepress really exists:
    if( $options['lang'] && isset($sitepress) )

    Greetings Maik

  • Hi @neoslix

    Thanks mate, I’ll add this into the next version.

    Cheers
    E

  • I think the conditional statement has to occue AFTER the global $sitepress statement, so perhaps this would be the fix:

    
    // WPML
    		if( $options['lang'] )
    		{
    			global $sitepress;
    			
    			if( !empty($sitepress) )
    			{
    				$sitepress->switch_lang( $options['lang'] );
    			}
    		}
    

    Can you try that and let me know if it works?

    Thanks
    E

  • Hi @elliot,
    you are absolutely right. I missed the global $sitepress statement underneath.
    I can confirm that your fix works and solves the problem.

    Greetings Maik

  • I have WordPress 3.8 / ACF 4.3.4 and PolyLang 1.3.1.

    I can see the fix above included in core/fields/relationship.php but still cannot get Polylang to work with ACF.

    When I look in the database, it has the fields, but when I view the page, any advanced custom fields are not displaying in correct language, so something still isn’t being mapped properly.

    what additional info would you all need to help?

    thanks much
    William

  • Hi @river-clement

    If you are able to jump into the relationship field file and do some debugging, that would be great!

    Perhaps you can find the line which does not produce the desired result?

    Other than that, I will need to do some testing myself.

    Thanks
    E

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Incompatibility with Polylang’ is closed to new replies.