Do I need to deal with WordPress SQL Injection

Higher-level API functions like this in WP typically do the $wpdb->prepare() call to protect against MySQL injections. As for content by default comments do allow HTML, however it isn’t just anything. If you examine default-filters.php there are quite a few sanitizing functions hooked to processing comment data, including wp_kses_post() which limits HTML to white listed … Read more

How to Mass Delete Images from Media Library

You can do it with native WordPress codex calls like this ( source http://badlywired.com/technical-stuff/2014/11/10/code-to-delete-all-images-from-wordpress-or-nearly-all/ ) <?php /* create this code in a file in the main wordpress directory e.g. delmedia.php and access it via mydomain.com/delmedia.php */ // Include the wp-load’er include(‘wp-load.php’); $args= array( ‘post_type’ => ‘book’, // obvious ‘posts_per_page’ => -1 // get them all … Read more

Can’t get result from sql using ajax result

I have made some changes to your code. See now if this works – function myajax_inputtitleSubmit_func() { // check nonce $nonce = $_POST[‘nextNonce’]; if ( ! wp_verify_nonce( $nonce, ‘myajax-next-nonce’ ) ) die ( ‘Busted!’); $zipcode = $_POST[‘zip’]; // generate the response global $wpdb; $tablename = “{$wpdb->prefix}levering”; $sql = “SELECT Levering FROM {$tablename} WHERE Zip LIKE … Read more

Debugging WordPress

The basic technique of logging queries is that if SAVEQUERIES constant is defined to be true (it’s not by default for performance reasons) then $wpdb->queries will keep the log of queries performed. There isn’t anything on top of this that WordPress natively does. There are plenty of plugins around which work either by interpreting this … Read more

Complex WP SQL Query

After hours of searching and testing I finally came to a solution. This code and SQL shows events with a parent id of 0 and is ordered by the dates of child events. Raw SQL cannot be used to replace the default way WP queries the database but there are always some kind of workaround … Read more

Auto-update tables from database

qwip, There is one way to update your custom table while wordpress users table in action and for that you require to code with custom function which is called while some action perform by user. You can handle it by add_action(). There are several action act by wordpress for user(viz. user_register, deleted_user, etc). See below … Read more

Slow WP_Query for custom post type

That’s a known problem with WordPress and searches involving postmeta. What I’d try to do is to create a new taxonomy for “things” you’re usually searching the most: offer_order_status seems the better candidate, as it can be active or not. I’d create a taxonomy with two elements. That would reduce the time of your search … Read more

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