Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pm_exclude_drats($element_id, $uri_parts) {
- global $permalink_manager_uris;
- if(is_numeric($element_id) && !empty($uri_parts['uri'])) {
- while(empty($new_element_id)) {
- $post_id = (int) $element_id;
- $post = get_post($post_id);
- if($post->post_status == 'draft') {
- $uri = $uri_parts['uri'];
- unset($permalink_manager_uris[$post_id]);
- $element_id = array_search($uri, $permalink_manager_uris);
- } else {
- $new_element_id = $element_id;
- }
- }
- }
- return (!empty($new_element_id)) ? $new_element_id : $element_id;
- }
- add_action('permalink_manager_detected_element_id', 'pm_exclude_drats', 99, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement