[resolved] I can't add new posts (5 posts)

  1. Juan Viñas
    Posted 3 years ago #


    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.



  2. Juan Viñas
    Posted 3 years ago #

    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,

  3. Chouby
    Plugin Author

    Posted 3 years ago #

    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.

  4. Juan Viñas
    Posted 3 years ago #

    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! :)

  5. Chouby
    Plugin Author

    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Polylang
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic