When using the WYSIWYG editor to create links, and selecting an existing page or post from the selection list, those links will have a title attribute by default.

Is there a simple way of turning off this behaviour? I would like turning it off at its root (i.e., in the WYSIWYG editor) rather than hooking into the final result when it is output.

Is there any way to do this that doesn't require JavaScript (here is a solution that does) and doesn't require manually parsing the attribute out of the final HTML end result?

Googling stuff like wordpress remove title attribute post content doesn't seem to yield any helpful information - what they show is mostly removing the attribute from menus and page lists.

  • The title attribute is a useful for SEO and Accessibility as it gives more meaning to the link than just 'click here!' for example. I would leave it in and avoid removing it otherwise you'll be hurting some of your visitors with bad links etc.
    – Alex Older
    Feb 28, 2012 at 15:06
  • Thanks, but I have pressing reasons for getting rid of it. Chrome's tendency to display them on hover, for one; the link title not matching the linked text and creating confusion, for another.
    – Pekka
    Feb 28, 2012 at 15:20
  • The title attribute is not useful for SEO. It was in the past, but it was discounted by most engines due to abuse. Source: I do SEO for a living. Sep 22, 2012 at 16:36

1 Answer 1


You can create a small plugin to filter the posts and pages content, search for all the links in it and remove their title tag. This code will do it for you:


    Plugin Name: Remove link's title tag
    Description: Remove link's title tag from post contents
    Version: 1.0
    Author: Your name
    Author URI: http://www.yoursite.com/

function wp151111_remove_link_title_attribute_from_post_content( $content ) {

    $post_types = array( 'post', 'page' );

    if ( is_singular( $post_types ) ) :

        $doc = DOMDocument::loadHTML( $content );

        $anchors = $doc->getElementsByTagName( 'a' ); 

        foreach ( $anchors as $anchor ) :

            $anchor->removeAttribute( 'title' );


        $content = $doc->saveHTML();


    return $content;


add_filter ( 'the_content', 'wp151111_remove_link_title_attribute_from_post_content' );


Save it as "remove-links-title-tag.php" and upload it to your plugins folder, usually "/wp-content/plugins/". You can also paste the function and the filter hook directly into your theme's "functions.php" file.

The code can be easily adapted to filter also custom post types or to remove other attributes from other tags.

If you are having encoding issues after applying the filter, change this line

$doc = DOMDocument::loadHTML( $content );


$doc = DOMDocument::loadHTML( mb_convert_encoding( $content, 'HTML-ENTITIES', 'UTF-8' ) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.