Support » Plugin: Polylang » I can't add new posts

  • Resolved Juan Viñas



    I have a problem in the back end. When I press in the New post button, the page crashes.

    Entering in debug mode, I can read this line:

    Fatal error: Call to undefined method Polylang_Admin_Filters::current_language() in /usr/home/mysite/www/wp-content/plugins/polylang/include/api.php on line 12

    It happens when I try to add a new page too. It appears that the problem occurs when i’m trying to access to “post-new.php”.

    I’m using WP 3.4.2 and Polylang 0.9.5.


Viewing 4 replies - 1 through 4 (of 4 total)
  • I fixed the problem temporarily, but I don’t know if this will cause other problems, so I’m going to explain what I did.

    When page loads, the plugin creates a new Polylang_Admin_Filters (polylang.php / line 100). In Polylang_Admin_Filters class does not exists the current_language function. This function exists in core.php, line 923 (at the bottom of the file).

    So I copied current_language function from core.php to admin-filters.php, and all works now. But I don’t know if this could generate other problems. It seems that no, but I’m not sure. What do you think?

    Thanks again,

    Plugin Author Chouby


    It seems that another plugin or your theme is calling the function pll_current_language on backend (which is not possible).

    The solution (on Polylang side) to avoid the fatal error could be to modify the file polylang/include/api.php at line 12 and replace:

    return isset($polylang) ? $polylang->current_language($args) : false;


    return class_exists('Polylang_Core') && $polylang instanceof Polylang_Core ? $polylang->current_language($args) : false;

    If it solves the issue, I will include the modification in the next release.

    Yeah, this works!

    I have deleted the current_language function from admin-filters.php that I copied yesterday before try your solution, of course. Then I have replaced line 12 and now I can access to post-new.php again.

    We’ve found this problem because we are a web development company (Codigonexo) specialized in CMS, and we work with many plugins day after day. Polylang is a great solution for us, and we use it when we need multilanguage features in our WordPress sites. We’re very grateful for your work and support.

    Thank you Chouby! 🙂

    Plugin Author Chouby


    OK. Consider that the modification will be included in v0.9.6

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I can't add new posts’ is closed to new replies.