treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How do I remove title attributes from WP links?

  • I'm using functions.php to strip the auto-generated title attributes from links and have got most to work, but there are still some links that I can't find the right functions to call to strip their title attributes; for example, the links for "Post a Comment," "Recent Posts," and "Archives." Any help would be greatly appreciated.

    P.S. I know the title can be suppressed with js, but it's still in the code.

    Below is the code I'm currently using in my functions.php:

    // Remove title attributes
    
    function remove_title_attributes($input) {
        return preg_replace('/\s*title\s*=\s*(["\']).*?\1/', '', $input);
    }
    add_filter( 'the_category', 'remove_title_attributes' );
    add_filter( 'wp_list_categories', 'remove_title_attributes' );
    add_filter( 'get_the_category', 'remove_title_attributes' );
    add_filter( 'wp_list_pages', 'remove_title_attributes' );
    
  • Go to admin panel > pages > allpages > quick edit > tick uncheck in allow

  • That has nothing to do with the question I asked.