Skip to content

Commit ef06030

Browse files
authored
Wrap in exists check
This class isn't initialized if Polylang doesn't exist, but Polylang doesn't define pll_current_language if there aren't any languages, eg. you have a fresh installation and haven't configured it yet.
1 parent 0efafcf commit ef06030

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

classes/class-wplf-polylang.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ public function save_success_message( $message ) {
8585

8686
return $message;
8787
}
88-
88+
8989
public function ajax_object( $array ) {
90-
$array['lang'] = pll_current_language();
90+
if ( function_exists( 'pll_current_language' ) ) {
91+
$array['lang'] = pll_current_language();
92+
} else {
93+
$array['lang'] = null;
94+
}
9195
return $array;
9296
}
9397

0 commit comments

Comments
 (0)