I'm trying to create a plugin to not allow any weird characters into the permalink such as ®, ©, ™, ∞, &, etc...
I did a filter onto the 'editable_slug' and while this works for display purposes (the weird characters get filtered out), even though it might not show up in display, it is still being passed through when I update a post.
Anyone know how to actually make sure the data is passed AFTER I have cleaned it up? Or any idea on how I would go about doing this? Thank you!
Here is my plugin for reference:
if( !function_exists( 'strip_weird_permalink' ) )
{
function strip_weird_permalink($post_id)
{
$output = $post_id;
// strips all *non-ascii* characters
$output = preg_replace('/[^(\x20-\x7F)]*/','', $output);
return $output;
}
add_filter('editable_slug', 'strip_weird_permalink', 10, 1);
}