WordPress.org

Make WordPress Core

Ticket #10792: slug-slash-ampersand.2.patch

File slug-slash-ampersand.2.patch, 594 bytes (added by alxndr, 5 years ago)

replaces slashes with hyphens in post title slugs and taxonomy term slugs; replaces ampersands with "and" and "&c" with "etc" in post title slugs

  • .php

    old new  
    697697 
    698698       $title = strtolower($title); 
    699699       $title = preg_replace('/&.+?;/', '', $title); // kill entities 
     700       $title = preg_replace('/&c/','-etc-',$title); 
     701       $title = preg_replace('/&/','-and-',$title); 
     702       $title = preg_replace('/[\/\\\]/','-',$title); 
    700703       $title = str_replace('.', '-', $title); 
    701704       $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); 
    702705       $title = preg_replace('/\s+/', '-', $title);