Search multiple meta keys at once

You’ll want to use the ‘meta_query’ argument of WP_Query ( http://codex.wordpress.org/Class_Reference/WP_Query ) Here’s a snippet that uses two separate meta key comparisons: $query_args = array( ‘post_type’ => ‘event’, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘_start_date’, ‘meta_query’ => array ( array( ‘key’ => ‘_start_date’, ‘value’ => $_start_of_month, ‘compare’ => ‘>’, ), array( ‘key’ => … Read more

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

Can I explicitly specify ENGINE=InnoDB in WordPress?

If the code creating new tables uses dbDelta() (it should), you can filter the query (see wp-admin/includes/upgrade.php): add_filter( ‘dbdelta_create_queries’, function( Array $queries ) { foreach ( $queries as $table => $query ) { if ( FALSE !== stripos( $query, ‘CREATE TABLE’ ) ) { // change the query here } } return $queries; });

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.

Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

You should try running WP-CLI’s search-replace command. $ wp search-replace ‘http://example.com’ ‘https://example.com’ –all-tables But you said these URLs are placed from a shortcode? Then you need to find out what this shortcode actually is doing. As it not necessarily has saved the URLs to the database. Maybe it’s a setting in the shortcode and then … Read more

Using source control with WordPress

Have a look at this older question: How to: Easily Move a WordPress Install from Development to Production?. It covers migration and deployment of WP installations. For your more immediate issue, do backups of your database. Use a backup plugin (WP-DB-Backup is what I use, find it on the WP plugins repository) to handle this … Read more