Support » Plugin: Polylang » Some images disappeared from all languages after Polylang 3.1.4 update

  • Hi,

    After the latest update of our wordpress website (v5.9) and all related plugins (polylang 3.1.4, WPbakery 6.8.0, Filebird lite 4.9.8…) images have disappeared from all of our portfolio pages (excepted from cover pictures, see above link), and also from the STUDIO page (small pictures above the “Walk with us” and “Our Values” sections are missing).

    We have deactivated each plugin one by one, and only when deactivating Polylang plugin, all pictures do come back. So for now, we cannot have our website in both languages and with all pictures.

    Any help would be must appreciated.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Support Chrystl



    This is a known issue with the WPBakery 6.7.0 version (this has been discussed many times on this forum). To be short if you are running the WPBakery 6.8.0 version. The best is to rollback to the WPBakery 6.7.0 version waiting a fix. The WPBakery plan to fix it in a next release.

    Actually, this isn’t a WPBakery issue at all, methinks.

    I tracked the issue down, and the problem happens in a WPBakery function, true, but this code is the culprit:

    $attach_id = apply_filters( 'wpml_object_id', $attach_id );

    With Polylang enabled, the result of this is NULL, which then causes get_post() to return the current page instead of the attachment, and it breaks from there.

    What plugin, apart from WPML, might be touching that filter, hmm? ;]

    Incidentally, adding in

    add_action('init', function(){
       remove_filter('wpml_object_id', 'icl_object_id', 10, 4);

    – resolves the problem (but also likely disabled the associated functionality).

    I think that in wpml-legacy-api.php, on line 170:

    	function icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = '' ) {

    if you detect that the post type is attachment and the user did NOT enable Media Library translations, $return_original_if_missing should be switched to true and the original ID returned, like so:

       if (    'attachment' === get_post_type( $id )
            && get_option('polylang')['media_support'] === false ){
          $return_original_if_missing = true;

    If anyone’s interested, I’ve written a small plugin that fixes the issue, at least for now:

    @ellmanncreative I had the same problem. Tried your plugin and everything is ok now. Thank you!

    @cocciolina I’m glad that it solved the problem.

    Here’s hoping for a solution from the Polylang team down the line. 🙂

    Hi @ellmanncreative , I have the same problem.
    How can I use your php file as a plugin….?


    Update: I’ve got it!!
    Thanks so much!

    • This reply was modified 10 months, 1 week ago by zigric11.



    @ellmanncreative – this is probably a newbie question, but how do I implement the code fix on my site?

    Plugin Author Chouby



    if you detect that the post type is attachment and the user did NOT enable Media Library translations, $return_original_if_missing should be switched to true and the original ID returned

    This indeed could be like that. However the behavior of this filter is not ours. It’s part of the WPML API so here we intend to mimic the behavior of WPML, including when this behavior is not what we would have chosen ourselves. If we change this in our WPML compatibility code, there is a risk that we break something with another plugin which would be based on the current WPML behavior.
    According to our investigations, the same issue exists with WP Bakery 6.8.0 and WPML too (as expected).
    We reported the issue to the WP Bakery support team and provided them with a solution
    It seems to me that we can’t do more.
    Of course, if anyone detects a different behavior between the WPML API and our own implementation of this API he/she is more than welcome to open an issue on GitHub with explanations to reproduce this difference.

    @ellmanncreative – can you help me out? I’d like to implement your plugin on my site to solve the disappearing images problem, but I need some guidance on how to do it. Thanks!

    @zigric11 – Hi there. Were you able to implement Ellman Creative’s fix for this problem? Can you tell me how you did it?

    ellmann creative



    The simplest method is:

    a) create a new folder in wp-content/plugins/; name it polylang-wpbakery-image-compatibility-fix
    b) inside the new folder, create a new text file named polylang-wpbakery-image-compatibility-fix.php
    c) copy the code verbatim into the text file

    Remember to enable the plugin in your Plugins. The plugin should auto-disable itself if the function is removed or changed to return the original ID by default.

    ellmann creative



    Thank you for explaining the issue further. Much appreciated.

    @ellmanncreative won’t let me activate the plugin, wordpress deactivates it again

    dear @ellmanncreative we have a great problem. the categories problem.. It happens when we change the URL path from polylang setting:

    can you please make a plugin to solve that great problem 🙂 appreciate 🙂

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Some images disappeared from all languages after Polylang 3.1.4 update’ is closed to new replies.