Support » Fixing WordPress » Line breaks in Custom Fields

  • Resolved stew278


    I’m having troubles with content in custom fields not having a line break where I’ve inserted a hard return. I would like to avoid having to administer posts from other authors, just to enter BR tags in their posts (inside the custom fields).

    Is there something out there that successfully addresses this problem of not being able to have line breaks in custom fields?

Viewing 5 replies - 1 through 5 (of 5 total)

    and some other forum/weblog posts have the answers.

    Try searching using yahoo for “line breaks in custom fields wordpress” or similar.


    Actually, managing this wouldn’t be hard. You’d only need to pass whatever is displaying the custom field value through WordPress’ wpautop() function. For example, I might use the following to display only custom field values with the key ‘test’:

    <?php if(get_post_custom_values('test')) {
    foreach(get_post_custom_values('test') as $value) {
    echo wpautop($value);
    } ?>

    Whatever code/plugin used could be easily modified.

    Sorry, but I have to ask this (as I’m not that well versed in php and new to WordPress), but how would that look with the C2C plugin:

    <?php echo c2c_get_custom('Ingredients'); ?>

    I’ve seen before something about “wpautop” but have had no luck in successfully implementing it.

    This would do it:

    <?php echo wpautop(c2c_get_custom('Ingredients')); ?>

    Great! Thanks for that bit … works great for me 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Line breaks in Custom Fields’ is closed to new replies.