WordPress.org

Ready to get started?Download WordPress

Forums

Remove international characters from slug - Almost done - Bit help (1 post)

  1. Comparativa de Bancos
    Member
    Posted 3 years ago #

    Hello,

    I want to remove some characters from the slug, like "¿" that we use in spanish for opening a question.

    If I go to wp-includes/formatting.php and in
    function sanitize_title_with_dashes($title) line 820 wp32
    I add this
    $title = str_replace('¿', '', $title);
    just before
    $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);

    And it is working correctly. So when I write in the title "¿Qué tal?" the slug is "que-tal"

    Now, how to do it with a function so I can use it via functions.php or via a plugin??

    I am doing this but it is not working

    function limpiar_slug($slug)
    {
    	$slug = str_replace('¿', '', $slug);
    	return $slug;
    }
    
    add_filter('sanitize_title_with_dashes', 'limpiar_slug');

    Any suggestion???

    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by Comparativa de Bancos
  • This topic is not resolved
  • WordPress version: 3.2