Skip to content

Instantly share code, notes, and snippets.

@LiamBailey
Created June 8, 2016 17:22
Show Gist options
  • Save LiamBailey/67662eec6b25784b0593f7d932713a66 to your computer and use it in GitHub Desktop.
Save LiamBailey/67662eec6b25784b0593f7d932713a66 to your computer and use it in GitHub Desktop.
add_action('init','run_my_query');
function run_my_query() {
$todays_date = date("Y-m-d");
if (get_transient("_query_run_".$todays_date))
return;
set_transient("_query_run_".$todays_date,24 * HOUR_IN_SECONDS);
global $wpdb;
$query = "UPDATE wp_2_posts SET menu_order = '9999999' where id in (SELECT DISTINCT tr.object_id FROM wp_2_terms t, wp_2_term_taxonomy tt, wp_2_term_relationships tr WHERE (t.term_id = tt.term_id) AND (tt.term_taxonomy_id = tr.term_taxonomy_id) AND t.term_id = 1440)";
$wpdb->query($query);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment