• Resolved Guillaume G.

    (@g4ll4is)


    Hi,

    I’m using the set title feature, with {text_clean}, but the <bdo> tag doesn’t get stripped.

    My link source is something like :

    <a href="foo"><bdo lang="fr" dir="ltr">Du texte français</bdo> (external link)</a>

    WP Links then outputs a title like :

    <a href="foo.com" tilte="title="&lt;bdo lang=&quot;fr&quot; dir=&quot;ltr&quot;&gt;Du texte français&lt;/bdo&gt; (external link)</a>

    On hover, the title has HTML tags visible

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Alexandru Tapuleasa

    (@talextech)

    Hi,

    Title will just set the tilte=”” attribute, not the link text between the anchor tags so it will set <a title=”THIS”>NOT THIS</a>

    Thread Starter Guillaume G.

    (@g4ll4is)

    Sorry @talextech, but I don’t get how this works.

    The help text in the backend says :

    Use this <code>{title}</code> for the original title value and <code>{text}</code> for the link text (or <code>{text_clean}</code> for text stripped of HTML) as shown on the page

    So if I have this example link :

    <a href="#"><em>hello</em></a>

    When I use the set title feature with {text clean}, I would expect the title to be the link text stripped of HTML tags. Like this :

    <a href="#" title="hello"><em>hello</em></a>

    Instead, I got something like this, where the HTML tags aren’t stripped :

    <a href="#" title="&lt;em&gt;hello&lt;/em&gt;"><em>hello</em></a>

    The <em> tag should not make it into the title, even as &lt;em&gt; as I specifically used {text_clean}

    Am I missing something ?

    Plugin Author Alexandru Tapuleasa

    (@talextech)

    Sorry, you are right! We have added some extra sanitization a while back and we escaped that instead of stripping the tags 🙁

    We will push an update to fix it ASAP but in the meantime if you are comfortable editing code you can edit wp-external-links/includes/class-wpel-front.php line 298 and replace:

    $new_title = str_replace( array( '{title}', '{text}', '{text_clean}' ), array( esc_attr( $title ), esc_attr( $text ), esc_attr( $text ) ), $title_format );

    with

    $new_title = str_replace( array( '{title}', '{text}', '{text_clean}' ), array( wp_strip_all_tags( $title ), wp_strip_all_tags( $text ), wp_strip_all_tags( $text ) ), $title_format );

    Thread Starter Guillaume G.

    (@g4ll4is)

    Thanx !

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘{text_clean} doesn’t strip tag’ is closed to new replies.