PHP notices on plugin activation
-
When first activating the plugin, I’m getting this:
( ! ) Notice: Undefined index: default_lang in wp-content/plugins/polylang/include/api.php on line 55
The
pll_default_language
currently looks like this:function pll_default_language( $field = 'slug' ) { return ( $lang = PLL()->model->get_language( PLL()->options['default_lang'] ) ) && isset( $lang->$field ) ? $lang->$field : false; }
Something a bit more “safe” would look like this:
function pll_default_language( $field = 'slug' ) { $options = PLL()->options; if ( ! isset( $options['default_lang'] ) ) { return false; } return ( $lang = PLL()->model->get_language( $options['default_lang'] ) ) && isset( $lang->$field ) ? $lang->$field : false; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘PHP notices on plugin activation’ is closed to new replies.