Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pm_exclude_draft_posts($bool) {
- global $wpdb, $permalink_manager_uris;
- //$post_ids = $wpdb->get_col("SELECT DISTINCT ID FROM {$wpdb->posts} AS p LEFT JOIN {$wpdb->postmeta} as pm ON p.ID = pm.post_ID WHERE p.post_status = 'draft' AND pm.meta_key = '_post_revision_of' ORDER BY ID DESC");
- $post_ids = $wpdb->get_col("SELECT DISTINCT ID FROM {$wpdb->posts} AS p WHERE p.post_status = 'draft' ORDER BY ID DESC");
- if(!empty($post_ids)){
- foreach($post_ids as $post_id) {
- unset($permalink_manager_uris[$post_id]);
- }
- }
- return $bool;
- }
- add_filter('permalink_manager_deep_uri_detect', 'pm_exclude_draft_posts', 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement