Following on from my comment on your question.
The solution would be to hook your own filter onto the same functions sanitize_title_with_dashes
does, in this case i think you're just aiming to hook onto sanitize_title
as is done with sanitize_title_with_dashes
.
Simply ensure you hook on after sanitize_title_with_dashes
, which is hooked on at the default priority of 10.
Eg.
add_filter('sanitize_title', 'limpiar_slug', 11 );
No need to hack core files.
EDIT BELOW:
You could give some regex a try, here's a sample you can play with, code adapted from Adriana Villafañe's code in response to Regular expression - any text to URL friendly oneRegular expression - any text to URL friendly one on StackOverflow.
add_filter( 'sanitize_title', 'sanitize_title_extra' );
function sanitize_title_extra( $title ) {
$friendlyURL = htmlentities($title, ENT_COMPAT, "UTF-8", false);
$friendlyURL = preg_replace('/&([a-z]{1,2})(?:acute|lig|grave|ring|tilde|uml|cedil|caron);/i','\1',$friendlyURL);
$friendlyURL = html_entity_decode($friendlyURL,ENT_COMPAT, "UTF-8");
$friendlyURL = preg_replace('/[^a-z0-9-]+/i', '-', $friendlyURL);
$friendlyURL = preg_replace('/-+/', '-', $friendlyURL);
$friendlyURL = trim($friendlyURL, '-');
$friendlyURL = strtolower($friendlyURL);
return $friendlyURL;
}
Seems to do the trick of clearing up some unwanted characters, feel free to tweak, etc...