Strip HTML Tags but Keep adsense/ infolinks /other scripts (5 posts)

  1. muqeetsoomro
    Posted 3 years ago #

    I had worst complains but HTML which run in my posts and damage the template of blog. I search about to strip HTML tags I got following code
    that put in single.php of theme.

     the_content(''.__('Read more <span class="meta-nav">ยป</span>', 'sandbox').'');
    $old_content = ob_get_clean();
    $new_content = strip_tags($old_content, '<p><a><b><br /><input><form><img><textarea><li><ol><ul><table>');
    echo $new_content;

    I get this code from http://wordpress.org/support/topic/way-to-strip-html-from-the_content-1?replies=6
    This work fine for me but remove ad sense / other scripts that are present in posts. I search about this but no clue find.
    please help me

  2. Michael
    Forum Moderator
    Posted 3 years ago #


    you possibly need to extend the exempted tags to include <script> and whatever tags are in the adsense/scripts

  3. muqeetsoomro
    Posted 3 years ago #

    I use "<script>" tag in allowed but adsense codes does not appear

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    what is the output of the code?

    does the script code appear in the output?

    can you post a link to a post with the problem?

    can you paste the full code of single.php into a http://pastebin.com/ and post the link to it here? (see http://codex.wordpress.org/Forum_Welcome#Posting_Code )

  5. muqeetsoomro
    Posted 3 years ago #

    pastebin http://pastebin.com/zSfBZPsE
    ads in post don't appear... that is output by using <script>

    Again I repeat my Question How I can allow the scripts tag above code

Topic Closed

This topic has been closed to new replies.

About this Topic