• On few my websites Polylang started to work quirky with CPT (on normal posts it work normal).
    In Polylangs options I have checked the CPT that it should translate.
    So it looks like that:
    1. I create new post (its one of the CPT) and the deafult language is set, I see categories for that languages.
    2. I save post.
    3. Now I see all the categories, for all languages – on posts list, in column with languages (you know, the plus sign, the check sign) there is nothing.
    4. So I edit post, change the language to different one, the proper categories are on, then I change again language to default and again categories are OK.
    5. Save post and it works.

    In shorter version:
    1. Create new post.
    2. Save.
    3. Change language – wait for apperance the proper categories.
    4. Change again language.
    5. Save post again. Now it works.

    I have observe that now on three of my websites.

    https://www.ads-software.com/extend/plugins/polylang/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter bastetmilo

    (@bastetmilo)

    OK, I make tests and problem was with plugin Events Calendar.
    I describe that on their forum https://tri.be/support/forums/topic/events-calendar-broke-polylang/#DiscussionForm

    I can’t turn off nor Polylang, nor Events Calendar ??

    Plugin Author Chouby

    (@chouby)

    Yes, you are right. The problem is coming from the events calendar plugin.

    In v2.0.11, this is coming from the line 1887 in lib/the-events-calendar.class.php

    remove_action( 'save_post', array( $this, 'publishAssociatedTypes'), 25, 2 );

    It’s due to a not well documented issue in the plugin API of wordpress. See tickets #9968 and #17817

    From what I read from the source code of the plugin, it does not appear obvious that this line is useful. Just ask the authors if you can safely remove it.

    Thread Starter bastetmilo

    (@bastetmilo)

    OK, thank you very much for you answer. ??

    ps. BTW I love Polylang ??

    Plugin Author Chouby

    (@chouby)

    I looked at your conversation on the support forum of the events calendar plugin. By the way I am sure this plugin does not break only Polylang, but also custom fields template, which is as popular as ‘the events calendar’, and probably others…

    Looks they don’t want to find a better way to code ?? although I am quite sure it’s possible. Finding out this issue, I reviewed my own code and modified one function to avoid breaking other plugins. And there is a different way to code Akismet to avoid it breaks other plugins too (as reported in the links I posted above).

    Well… Probably you don’t use ‘custom fields template’, otherwise you would have noticed some issues, so I propose you this workaround:

    Copy paste the code below in a text file called something.php, upload this file in your plugins directory and activate the new plugin.

    <?php
    /*
    Plugin Name: My personnal plugin
    */
    
    global $polylang;
    if (isset($polylang) && $polylang instanceof Polylang_Admin_Filters) {
    	add_action ('wp_loaded', 'pll_admin_init'); // after Polylang
    }
    
    function pll_admin_init() {
    	global $polylang;
    	if (remove_action('save_post', array(&$polylang, 'save_post'), 200, 2))
    		add_action('save_post', array(&$polylang, 'save_post'), 22, 2); // before the event calendar
    }

    The curious priority ’22’ is to keep the compatibility with ‘advanced custom fields’

    For the future, I will try to offer a compatibility with both ‘the events calendar’ and ‘custom fields template’ (although not at the same time as this is currently not possible).

    Plugin Author Chouby

    (@chouby)

    Could you ask to the events calendar plugin author if replacing the line 1887 of lib/the-events-calendar.class.php:

    remove_action( 'save_post', array( $this, 'publishAssociatedTypes'), 25, 2 );

    by

    static $once = false;
    if ($once) return;
    $once = true;

    doesn’t do what they intend?

    Plugin Author Chouby

    (@chouby)

    The current development version of Polylang (1.1.1.3) should now be compatible with The Event Calendar without the need for the personal plugin described above.
    https://downloads.www.ads-software.com/plugin/polylang.zip

    Thread Starter bastetmilo

    (@bastetmilo)

    Hi,

    thank you for help and answers and all what you did. I’m going to test the new version of Polylang and get back to you with the results.

    ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Polylang works quirky on CPT’ is closed to new replies.