• Hi. ogs_admin_inline_style() can return null, which will then be passed to wp_add_inline_style(). This is not good, because then null gets into the stripos function and trigger message:

    PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in \wp-includes\functions.wp-styles.php on line 90

    It also prints an empty style tag in the pages html. To avoid this, you need to add a check in two plugin functions. Here is the corrected part of plugin code:

    function ogs_add_admin_inline_style() {
    	$style = ogs_admin_inline_style();
    
    	if (!is_null($style)) {
    		wp_add_inline_style( 'ogs_style', $style ); // admin inline
    	}
    }
    
    // add style inline frontend
    add_action( 'wp_head', 'ogs_add_frontend_inline_style' );
    function ogs_add_frontend_inline_style() {
    	$style = ogs_admin_inline_style();
    
    	if (!is_null($style)) {
    	echo "<style>" . $style . "</style>\r\n";
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Small error in otfm-gutenberg-spoiler.php’ is closed to new replies.