Deprecated update_option value (due to error in the code)
-
Hi,
It’s the same as in this thread.
There is an issue in the logic of checking for the WP version in order to update deprecated or new option:
function compatible() { return ( intval( explode( '.', get_bloginfo('version') )[0]) >= 5 && intval( explode('.', get_bloginfo('version') )[1]) >= 5 ) ? true : false; }
This is checking for the two first numbers in the version, and returning true if both are bigger or equal 5 which makes no sense:
5.6.0 -> true
but
6.0.1 -> false (because 0 < 5)So then the below causes the issue:
# 'Comment author must have a previously approved comment' (checked) if ( compatible() ) { update_option( 'comment_previously_approved', 1 ); } else { update_option( 'comment_whitelist', 1 ); # deprecated since WP 5.5.0 }
Deprecated: Function update_option was called with an argument that is deprecated since version 5.5.0! Zmieniono nazw? opcji z “comment_whitelist” na “comment_previously_approved”. in /Users/dawid/Local-Sites/pyrkonpanel/app/public/web/wp/wp-includes/functions.php on line 5663
Ideally function
compatible
should useversion_compare()
to identify compatible WP version.version_compare( get_bloginfo('version'), '5.5', '>=' )
- The topic ‘Deprecated update_option value (due to error in the code)’ is closed to new replies.