Created
June 8, 2016 17:22
-
-
Save LiamBailey/67662eec6b25784b0593f7d932713a66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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