: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Smush\Core\Modules\Background;
* Thread safe version of get_site_option, queries the database directly to prevent use of cached values
* @param $option_id string
public function get_site_option( $option_id, $default = false ) {
$key_column = 'option_id';
$value_column = 'option_value';
$table = $wpdb->sitemeta;
$value_column = 'meta_value';
return $this->get_value_from_db( $table, $column, $key_column, $option_id, $value_column, $default );
public function get_option( $option_id, $default = false ) {
$key_column = 'option_id';
$value_column = 'option_value';
return $this->get_value_from_db( $table, $column, $key_column, $option_id, $value_column, $default );
private function get_value_from_db( $table, $column, $key_column, $option_id, $value_column, $default ) {
$row = $wpdb->get_row( $wpdb->prepare( "
ORDER BY {$key_column} ASC
if ( empty( $row->$value_column ) || ! is_object( $row ) ) {
return maybe_unserialize( $row->$value_column );