Advertisement
mbis

Convert slashes to dashes

Aug 19th, 2019
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. function pm_convert_slashes($slug, $object) {
  2.     $title = (!empty($object->post_title)) ? $object->post_title : $object->name;
  3.  
  4.     return sanitize_title(str_replace('/', '-', $title));
  5. }
  6. add_filter('permalink_manager_filter_default_term_slug', 'pm_convert_slashes', 99, 2);
  7. add_filter('permalink_manager_filter_default_post_slug', 'pm_convert_slashes', 99, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement