Created
June 18, 2018 09:48
-
-
Save anthonybudd/485fbf1fa6dab9be3180a0ab0acff4a1 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
| <?php | |
| Class ClearOrphanMetaAction extends WP_AJAX{ | |
| protected $action = 'clear-orphan-meta-action'; | |
| protected function run(){ | |
| global $wpdb; | |
| $wpdb->get_results(" | |
| DELETE meta | |
| FROM {$wpdb->postmeta} meta | |
| LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id | |
| WHERE posts.ID IS NULL | |
| "); | |
| } | |
| } | |
| ClearOrphanMetaAction::listen(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment