Support » Plugin: SportsPress - Sports Club & League Manager » Polylang Conflict: unable to save CPT’s in selected language

  • Resolved cambofrizz


    I have Polylang installed together with SportsPress. But whenever I try to add or edit a Match, Calendar, League Table or other custom post types, they are saved under a new language with a number (in my case 86, but that may be different with others).

    This issue was reported before in your support section, where you suggested it was probably caused by Polylang.

    So, I posted on their support thread trying to find a solution.

    However, digging in further I found that the ‘Details’ section has a php function to include CPT-depending input fields, they are called with

    	foreach ( $taxonomies as $taxonomy ) {
    	sp_taxonomy_field( $taxonomy, $post, true );

    When I remove this, the ‘Language’ heading and inputs disappear, along with of course all the other (needed) inputs like ‘League’, ‘Season’, etc. But I can edit and save now normally, without a strange language number added.

    I think I found the culprit but I’m not sure whether Polylang should prevent being included with the above ‘foreach’ or whether SportsPress should change the call for taxonomies to exclude Polylang’s.

    • This topic was modified 1 month, 2 weeks ago by cambofrizz. Reason: typo
Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter cambofrizz


    I’ve made a small change in the function sp_taxonomy_field (in sp-core-functions.php) which seems to do the trick.
    I’ve changed lines 1506 and 1507 from:

    $obj = get_taxonomy( $taxonomy );
    if ( $obj ) {


    $obj = get_taxonomy( $taxonomy );
    $exclude = array( 'language', 'post_translations' );
    if( !in_array( $obj->name, $exclude ) ) {

    Maybe there are better ways to do this. If so, please let me know.

    Thread Starter cambofrizz


    It’s probably a bit better to have it as:

    if( $obj && !in_array( $obj->name, $exclude ) ) {

    but you get what I’m at I hope.

    The question remains: is it something you should change or something Polylang should change? Haven’t tested this with WPML, but if it doesn’t occur with that plug-in, then it’s maybe Polylang after all that should make a change?

    Anyone have more insights?

    • This reply was modified 1 month, 2 weeks ago by cambofrizz. Reason: more clarification
    Plugin Contributor Roch


    Hi there!

    Thanks for reaching out.

    This really looks like something that should be dealt with by Polylang. If we need to create an exception in our plugin for a specific plugin (like in this case), it looks like they have an issue with when they append their code or how it should be filtered.

    Should this was the standard approach (as per WP guidelines) then it’s fine, we should surely add this to our source. But it doesn’t seem to be the case.

    If I understood the issue correctly, it looks like they use the same post for all languages. And that’s a valid approach, but it runs into issues when we have custom metaboxes like this one.

    Another approach (which is what WPML uses) creates 2 different events, and links them as being to one language or the other. This won’t face the same issues (as you are in fact creating 2 separate sites), but has other issues, which are usually deal with by WPML.


    Thread Starter cambofrizz


    You don’t understand the issue correctly, Polylang uses different posts for each language and connects them, just like WPML does.

    You’re assuming this and that and using ‘looks like’, ‘seem that’, while you don’t even know what you’re talking about.

    Do you even care much about SportsPress? I surely get the impression you don’t and consider it a ‘finalized project’.

    Plugin Contributor Savvas


    Hi @cambofrizz ,

    SportsPress is an opensource project. The code is available to anyone in github, where you can fork it for free and alter as you wish. WP forum is a community were users trying to help each other. Please give a look at the Forums Guidelines before further posting:

    Now about your issue. I try to use Polylang and it seems to be a conflict with SportsPress. Even if I disable sp_taxonomy_field() function. So the conflict is somewhere else inside SportsPress or/and Polylang code.

    I also tried WPML and it is working fine.

    So lets see what the Polylang support will respond to your topic there and continue the investigation further.


    Thread Starter cambofrizz


    I’ve not received any response to my questions on the Polylang support forum and on top of that the latest version of their plug-in causes even more trouble. So, it seems you’re right and it’s a Polylang problem.

    So, I’ll mark this as resolved, not because it is, but because it’s not a SportsPress problem. Thank you for your time.

    Plugin Contributor Roch


    Hey cambofrizz

    I’m marking this one for modlook as well. This isn’t the first time you are disrespectful to me and to our project in this forum.

    If you don’t agree with something I say or with how we create/maintain our plugin, that’s fine. Share your feedback, fork the project and add your own code, try alternatives. That’s up to you.

    But being polite and respectful is a must, not only in our forums, but in the WP forums in general.


    Moderator Steven Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    Moderator note: I don’t see anything here that violates guidelines or requires moderator intervention. And, it’s good that you’ve managed to track down the underlying issues.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.