Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created March 3, 2016 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/ec6b7106d33b79c69e26 to your computer and use it in GitHub Desktop.
Save tommcfarlin/ec6b7106d33b79c69e26 to your computer and use it in GitHub Desktop.
[WordPress] Escaping Strings For WordPress Database Queries
<?php
$query = 'SELECT value FROM wp_acme_table WHERE value LIKE "%' . mysqli_real_escape_string( $value ) . '%"';
<?php
$value = 'Fox Mulder says "I want to believe."';
$query = 'SELECT value FROM wp_acme_table WHERE value LIKE "%' . mysqli_real_escape_string( $value ) . '%"';
<?php
'SELECT value FROM wp_acme_table WHERE value LIKE "%Fox Mulder says "I want to believe."%"';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment