Echoing a variable comes out with lots of white space

Question

I’m having trouble when I get variables from WP function come out very long. How do I trim that down? trim and substr do not see the spaces before or after. Why is it so long?

<?php  $image_alt = trim(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)); ?>
            <?php echo $image_alt;?>

when I view the source it looks like this:

"

                        HIPAA compliant Times-2 X2 Rotating Shelving Rotating Cabinet Starter and Add-on       " 
0
, dsax 7 months 0 Answers 66 views 0

Leave an answer