How to remove these comments and html tags from the content?

enter image description here

These are actually input fields.
paragraph is the textarea field.
i query the contents from database and try to show them in this textarea field.
But the textarea field is showing me unwanted comments and tags.
When I echo them outtside the textarea field, it is fine.

My code….

 <?php while($userNotes->have_posts()): $userNotes->the_post(); ?>

    <li>
        <input value="<?php echo esc_attr(get_the_title()); ?>" class="note-title-field">

        <span class="edit-note"><i class="fa fa-pencil" aria-hidden="true"></i> Edit</span>

        <span class="delete-note"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</span>

        <textarea class="note-body-field"><?php echo esc_attr(get_the_content()); ?></textarea>

    </li>

    <?php endwhile; ?>

2 Answers
2

Can you please try this php function html_entity_decode(get_the_content());. I have used this function on php to remove html tags, you can try this.

Leave a Comment