Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pm_directory_tags($default_uri, $native_slug, $element, $slug, $native_uri) {
- // Do not affect native URIs
- if($native_uri == true) { return $default_uri; }
- if(strpos($default_uri, '%drts_page_slug%') !== false) {
- $page_slugs = get_option('drts_page_slugs');
- if(!empty($page_slugs[5])) {
- $all_data = $page_slugs[5];
- foreach($all_data as $index => $data) {
- if(!empty($element->post_type) && !empty($data['post_type']) && $element->post_type == $data['post_type']) {
- $drts_page_slug = (!empty($page_slugs[0][$index])) ? $page_slugs[0][$index] : '';
- } else if(!empty($element->taxonomy) && !empty($data['taxonomy']) && $element->taxonomy == $data['taxonomy']) {
- $drts_page_slug = (!empty($page_slugs[0][$index])) ? $page_slugs[0][$index] : '';
- }
- }
- }
- $default_uri = str_replace('%drts_page_slug%', $drts_page_slug, $default_uri);
- }
- return $default_uri;
- }
- add_filter('permalink_manager_filter_default_post_uri', 'pm_directory_tags', 3, 5);
- add_filter('permalink_manager_filter_default_term_uri', 'pm_directory_tags', 3, 5);
Add Comment
Please, Sign In to add comment