wordpresscustom-fields

WPautopop in post_meta


I want allow paragraphs in post_meta of custom type. I think is with WPautopop but how use it in this code? Really thanks

<?php $metacontenido = get_post_meta($postid, 'ofertacontenido', true);
    if($metacontenido != $empty) { echo "".$metacontenido.""; }?>

Solution

  • The wpautop() function will automatically convert line endings to <p> tags. You can read more about it here.

    <?php $metacontenido = get_post_meta($postid, 'ofertacontenido', true);
          if($metacontenido != $empty) { wpautop($metacontenido); } ?>