How to properly sanitize strings without $wpdb->prepare?

I can’t use $wpdb->prepare, since I want to be able to add variables to my query string that look something like: $var = “AND pm.meta_value=”%$_POST[“val’]%'”; To get a literal % to pass through $wpdb->prepare just double it. You don’t need to be avoiding $wpdb->prepare. Proof of concept: var_dump($wpdb->prepare(‘SELECT * FROM {$wpdb->posts} WHERE post_title LIKE “%%%s%%”‘,’Hello’)); … Read more

Shortcode putting html such as

This behavior is most likely intended, and can be disabled. However it might break other features too. There are a couple of workarounds, that you can try. Break the Image URL and File Name You can pass the arguments to your shortcode in the following way: [theimg path=”https://s.w.org/about/images/logos/” filename=”wordpress-logo-simplified-rgb.png” ] This will prevent the editor … Read more

Make shortcode work with nested double quotes

Either way this seems like a very clunky solution for arbitrary markup in shortcode. If only one of attributes is more bulky and includes markup I would consider making shortcode enclosing: [infobox src=”http://www.google.com” title=”Google”] Some description – see more: <a href=”http://www.google.com”>More here</a> [/infobox] You might be to the point when you’ll need to built custom … Read more

Should nonce be sanitized?

Sanitizing is required when you are inserting user input into Database or outputting it in HTML etc. Here, you are simply doing a String comparison. wp_verify_nonce function checks $nonce value like this: if ( hash_equals( $expected, $nonce ) ) { return 1; } For this you don’t need sanitizing. So the following is fine: wp_verify_nonce( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)