SQL query to update post_date (one post = one single date & time)

I would not do this with SQL. A relatively simple PHP loop should work. function bulk_schedule_posts_wpse_105834() { $args = ( array( ‘cat’ => 1, ‘posts_per_page’ => -1, ‘post_status’ => ‘draft’, ‘post_type’ => ‘post’, ) ); $posts = new WP_Query($args); if (!$posts->have_posts()) return false; $date=”2013-08-01″; $times = array( ’10:00′, ’14:00′, ’17:00′, ’20:30′ ); while ($posts->have_posts()) { … Read more

Database location in WordPress

You can find the database information by looking at your wp-config.php (which will be in your WordPress root folder). Your wp-config.php will probably tell you then that your database host is “localhost” (DB_HOST) and since you are using XAMPP locally, the location of your DB would be wherever you are running MySQL basis your XAMPP … Read more

Improve or optimize a very slow query

Persuming “article_datetime” to be a numeric value, I would suggest that instead of using ‘orderby’ => ‘meta_value’ use ‘orderby’ => ‘meta_value_num’ If still query is slow, than remove: ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘article_datetime’, ‘order’ => ‘DESC’ and instead sort the result in php.

How to ensure data consistency in WordPress

No, you are not missing something. But you are using the wrong “framework” (which WordPress is not) for your use case, it seems. And you are mixing things up. What you are talking about, A.C.I.D. transactions, is by no means what you think it is for. ACID: save crash recovery (due to soft- or hardware … Read more

Shared Members between two different wordpress installations with different databases

I had to do something similar. What you need to do first is in each of your config files define the table prefix … make sure that they are different. Example: WordPress installation 1: wp123_ WordPress installation 2: wp124_ Your first installation would be your main installation the one with the user table you want … Read more

Inserting Post Meta From SQL

Actually, the customary way to do this in WordPress would be to use <?php update_post_meta($post_id, $meta_key, $meta_value, $prev_value); ?> as per the codex: https://codex.wordpress.org/Function_Reference/update_post_meta. It yields shorter code, and the intent of the code is clearer.