Undefined variable $priority (with fix)
-
Hello, my name is Alduin and I’ll be your dragon today π²
I have administration privileges on a website that uses this plugin. And while looking for another issue, I found two warnings in the logs that I want gone because the less random stuff is in the logs, the sooner I find the actual problem ;β)
So here’s a message I have:
PHP message: PHP Warning:
Undefined variable $priority in /.../wp-content/plugins/event-organiser/includes/class-eo-theme-compatability.php on line 190; PHP message: PHP Warning: Undefined variable $priority in /.../wp-content/plugins/event-organiser/includes/class-eo-theme-compatability.php on line 213Fix is rather easy. In said file, find (line 190):
$this->remove_filter( 'post_class', $priority );and replace with:
$this->remove_filter( 'post_class', $priority ?? 10 );Find further (line 213):
add_filter( 'post_class', array( $this, 'post_class_events_page' ), $priority, 3 );replace with:
add_filter( 'post_class', array( $this, 'post_class_events_page' ), $priority ?? 10, 3 );The warning complains about
$prioritynot being set. So what my change does is to use$priorityif it happens to be set and if not, assume a default value which I set to 10 because I think this is what WordPress would do if left empty.Please, add this to the main code so that it’ll be update-safe. :β)
Thank you!
The topic ‘Undefined variable $priority (with fix)’ is closed to new replies.