Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Last active March 21, 2017 14:17
Show Gist options
  • Save tommcfarlin/cdc5a95834e8bf581fc8ac65fad6ce20 to your computer and use it in GitHub Desktop.
Save tommcfarlin/cdc5a95834e8bf581fc8ac65fad6ce20 to your computer and use it in GitHub Desktop.
[WordPress] Direct Database Queries in WordPress
<?php
private function set_all_scheduled_events_as_public() {
global $wpdb;
// @codingStandardsIgnoreStart
$wpdb->query(
$wpdb->prepare(
"
UPDATE $wpdb->posts
SET post_status = '%s'
WHERE post_type = '%s'
AND post_status = '%s'
",
'publish',
'tribe_events',
'future'
)
);
// @codingStandardsIgnoreEnd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment