grappler / polylang-slug

A unique post slug within the language in Polylang. This allows for a page to have same/identical slug in multiple languages.
275 stars 84 forks source link

Fatal error: Call to undefined function pll_current_language() #21

Closed maartenkools closed 8 years ago

maartenkools commented 8 years ago

Hi,

Awesome plugin you made here! I've just activated this plugin with the latest polylang beta (1.8beta3), and got the message

Fatal error: Call to undefined function pll_current_language() in (...)polylang-slug\polylang-slug.php

I added

require_once( PLL_INC . '/api.php');

at the top of the file, which seems to fix it. Any idea why this is happening?

Maarten

grappler commented 8 years ago

On what page are you getting the error?

grappler commented 8 years ago

Could you try the latest version and see how that goes?

maartenkools commented 8 years ago

The same happens with the latest version.

Here's the call stack:

1 0.0000 242760 {main}( ) ..\index.php:0 2 0.0010 245904 require( 'wp-blog-header.php' ) ..\index.php:17 3 0.0210 265936 require_once( 'wp-load.php' ) ..\wp-blog-header.php:12 4 0.0380 277896 require_once( 'wp-config.php' ) ..\wp-load.php:37 5 0.0530 403344 require_once( 'wp-settings.php' ) ..\wp-config.php:91 6 1.6801 19363272 include_once( 'wp-content\plugins\wordpress-seo\wp-seo.php' ) ..\wp-settings.php:254 7 1.6811 19456752 require_once( 'wp-content\plugins\wordpress-seo\wp-seo-main.php' ) ..\wp-seo.php:47 8 1.7041 19615344 WPSEO_OnPage->construct( ) ..\wp-seo-main.php:353 9 1.7121 19633320 WPSEO_OnPage_Option->construct( ) ..\class-onpage.php:32 10 1.7121 19633408 WPSEO_OnPage_Option->get_option( ) ..\class-onpage-option.php:45 11 1.7121 19633976 get_option( ) ..\class-onpage-option.php:112 12 1.7121 19635216 wpdb->get_row( ) ..\option.php:83 13 1.7121 19635368 QM_DB->query( ) ..\wp-db.php:2247 14 1.7121 19635368 wpdb->query( ) ..\db.php:90 15 1.7121 19635448 apply_filters( ) ..\wp-db.php:1691 16 1.7121 19636768 call_user_func_array:{wp-includes\plugin.php:235} ( ) ..\plugin.php:235 17 1.7121 19636912 polylang_slug_filter_queries( ) ..\plugin.php:235 18 1.7121 19637024 polylang_slug_should_run( ) ..\polylang-slug.php:130 19 1.7161 19625520 QM_Collector_PHP_Errors->shutdown_handler( ) ..\php_errors.php:0 20 1.7161 19626880 xdebug_print_function_stack ( ) ..\php_errors.php:142

grappler commented 8 years ago

Thank you for the call stack. I was able to replicate the issue and fix it. It was being caused by WP SEO.

maartenkools commented 8 years ago

Awesome, thanks for the quick fix!