title: mysqli_real_escape_string() expects parameter 2 to be string error in WordPress
body: <p>I am using WordPress for one of my website,and suddenly i got this error while logging which was working fine before.</p>
  
  <blockquote>
    <p>Warning: mysqli_real_escape_string() expects parameter 2 to be string,
    object given in /public_html/wp-includes/wp-db.php on line 1105</p>
  </blockquote>
  
  <p>This is the function which is causing issue.</p>
  
  <pre><code>function _real_escape( $string ) {
  
      if ( $this-&gt;dbh ) {
          if ( $this-&gt;use_mysqli ) {
              $escaped = mysqli_real_escape_string( $this-&gt;dbh, $string );
          } else {
              $escaped = mysql_real_escape_string( $string, $this-&gt;dbh );
  
          }
  
          $escaped = addslashes( $string );
      }
  
      return $this-&gt;add_placeholder_escape( $escaped );
  }
  </code></pre>
  
  <p>Note: my current PHP version is 5.6</p>