1

I need to add some html to shortcode image tag for example

<img src="http://image.com/design/images/5Stars.png" alt="5 star rating">

When I check value in database, I can see all double quotation marks formatted with backslashes

<img src=\"http://image.com/design/Images/5Stars.png\" alt=\"5 star rating\">

I have tried to use “htmlspecialchars()” and “esc_attr()” but when I using shortcode I can see simple text instead of html.

zhoradk
  • 43
  • 8

1 Answers1

0

Try with ob_start like this example:

function my_shortcode() {
    ob_start();
    ?> <HTML> <here> ... <?php
      return ob_get_clean(); }
softbrewery
  • 501
  • 6
  • 18