Josh Kennedy Josh Kennedy - 1 year ago 76
PHP Question

Escape WordPress's HTML characters in the_content();

I'm trying to create a custom Facebook share button on a WordPress theme

<a title="Facebook This" href="[title]=MY%20TITLE%20-%20<?php the_title(); ?>&p[summary]=<?php the_content(); ?>&p[url]=<?php the_permalink(); ?>&p[images][0]=<?php bloginfo('template_url'); ?>/images/logo.png" target="_blank">Facebook This</a>

I have everything working splendidly except that Facebook insists on displaying the HTML characters in the description:

<h3>Intro</h3><p>it shows all the tags here and it won't stop!!!</p>...

It does this with the_excerpt() as well.

Does anyone know a quick way to remove the html tags for this?

Answer Source

Use Strip tag, deatils on:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download