Small mistake in class-coblocks-generated-styles.php
-
Hi. In some situations styles() in class-coblocks-generated-styles.php can return null, which will then be passed to wp_add_inline_style(). This is not good, because then null gets into the stripos() and it gives “deprecated” message in PHP 8.1:
PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in \wp-includes\functions.wp-styles.php on line 90To avoid this, you need to add a check in plugin function. Here is the fix:
/** * Footer Styling * * @access public */ public function enqueue_styles() { $style = $this->styles(); if (!is_null($style)) { wp_add_inline_style( 'coblocks-frontend', $style ); } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Small mistake in class-coblocks-generated-styles.php’ is closed to new replies.