WordPress.org

Support

Support » Themes and Templates » How to keep line breaks/paragraphs in image description?

How to keep line breaks/paragraphs in image description?

  • I’m using this code from Dameian to pull the image attachments out.

    However, I’ve not been able to find a guide on how to keep line breaks in the image description when we upload it.

    Please do share a solution, if you know of one. Thanks.

Viewing 1 replies (of 1 total)
  • i assume that you simply echo the

    $img_description = $image->post_content; // description.

    try to apply a filter:

    $img_description = $image->post_content; // description.
    echo apply_filters('the_content',$img_description);

    that would wrap the string into paragraph tags and add html line breaks.

Viewing 1 replies (of 1 total)
  • The topic ‘How to keep line breaks/paragraphs in image description?’ is closed to new replies.
Skip to toolbar