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.
268 stars 84 forks source link

PolyLang 2.0.5 and Wordpress 4.6.1 not working. #32

Closed blackerfin closed 6 years ago

blackerfin commented 7 years ago

I'm trying to use the pll_current_language function but always return null and if I don't include the api.php file then break the page.

This is my code:

if ( !function_exists( 'pll_current_language' ) ) {
    require_once( PLL_INC . '/api.php');
}

$field = 'slug'; 

// NOTICE! Understand what this does before running.
$result = pll_current_language($field);

var_dump($result);

$result value is always false. I hava tryed to set $field to name, locale and slug with same result. I think that PLL is null and, when check isset(PLL()->curlang->$field) is not isset and then return false.

What can I do?

Thanks

grappler commented 7 years ago

Have you seen this issue? https://github.com/grappler/polylang-slug/issues/21

blackerfin commented 7 years ago

Yes, but dont work for me.

I have been trying and I can use the function in the front-end but not in the back-end.

I have a plugin development by me and I need know the idioma to charge an different .po file. I think that polylang plugin is charge after my plugin..

grappler commented 6 years ago

Seems this issue was for Polylang plugin itself than "Polylang Slug"