WordPress mysqli and PDO

WordPress uses mysql_* functions. http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/wp-db.php It has used those ever since I can remember, which probably answers your last question. It is what I would consider legacy code. I suspect it will be updated sometime soon (those functions were only deprecated as of PHP 5.5, I believe). I don’t know which route development will go. … Read more

How to replace the domain name in a WordPress database?

Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. The data you’re looking at is not JSON formatted. JSON doesn’t (normally) store value types and lengths like that. What you’re looking at is … Read more

What SQL Query to do a simple find and replace

The table where your URL is saved is wp_options. You should do an update on the columns that use the URL for your site: UPDATE TABLE wp_options SET option_value = “new domain” WHERE option_name = “siteurl” UPDATE TABLE wp_options SET option_value = “new domain” WHERE option_name = “home” I might be missing some value, but … Read more

How do you properly prepare a %LIKE% SQL statement?

The $wpdb->esc_like function exists in WordPress because the regular database escaping does not escape % and _ characters. This means you can add them in your arguments to wpdb::prepare() without problem. This is also what I see in the core WordPress code: $wpdb->prepare(” AND $wpdb->usermeta.meta_key = ‘{$wpdb->prefix}capabilities’ AND $wpdb->usermeta.meta_value LIKE %s”, ‘%’ . $this->role . … Read more

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