• Resolved ikke77

    (@ikke77)


    Hello,

    For the meta description I choose a custom field. Now when I share a link for example through whatsapp, the markup for the text is visible like <p> or <strong>.

    Tried a lot of things php strip tags, replace etc but nothing seems to work.

    Any suggestions how to fix this?

    Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi,

    can you paste the value of your custom field in <code> tag here please?

    Thx

    Thread Starter ikke77

    (@ikke77)

    Hello Benjamin,

    Off course, I use multiple for different pages, but below two examples:

    %%_cf_lan_english_txt%%
    %%_cf__description-se%% %%_cf__description-en%%

    Extra info regarding the last: sometimes the Swedish description is not available, so it will then use the English.

    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Thank you for your feedback but I meant the final value, the one in the source code.

    Thread Starter ikke77

    (@ikke77)

    Haha, you meant that code ??

    That’s like this:

    <meta name="description" content="<p>Just random text</p> <p>Another text...<p>">
    or
    <meta name="description" content="<p>Just <strong>random</strong text</p> <p>Another text...<p>">
    
    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Can you confirm you’re seeing something like this in your source code:

    <meta name="description" content="test &lt;p&gt;zzzzzzz&lt;/p&gt;">
    Thread Starter ikke77

    (@ikke77)

    Hello Benjamin,

    Yes, i see that, all is working, but it includes the html tags ( p strong br etc) from the %% custom field %%

    But it doesn’t include the characters as you mentioned:

     &lt;p&gt;zzzzzzz&lt;/p&gt;

    It just says: <p>zzzzzzz</p>

    • This reply was modified 1 year, 6 months ago by ikke77.
    Plugin Author Benjamin Denis

    (@rainbowgeek)

    OK, so currently this is not possible to act on this.

    But, we’ll add a hook in a future update to filter this.

    ETA: June/July

    Thread Starter ikke77

    (@ikke77)

    Thank you Benjamin, have a nice weekend! ??

    Marco

    (@michelyweb)

    If you want to remove HTML and HTML entities from meta description you can use this filter:

    function sp_titles_desc($html) {
    	return strip_tags(html_entity_decode($html));
    }
    add_filter('seopress_titles_desc', 'sp_titles_desc');

    See https://www.seopress.org/support/hooks/filter-meta-description/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove html tags from meta description’ is closed to new replies.