you have to apply the autop and probably the other filters that are normally applied to the_content() to the data you retrieve from get_post_meta.
this is why i usually do in similar situations:
/* @Recreate the default filters on the_content
-------------------------------------------------------------- */
add_filter( 'meta_content', 'wptexturize' );
add_filter( 'meta_content', 'convert_smilies' );
add_filter( 'meta_content', 'convert_chars' );
add_filter( 'meta_content', 'wpautop' );
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment' );
then change your code to:
<?php $text = get_post_meta($post->ID, 'wpcf-wysiwygfield', true); ?>
<?php echo apply_filters('meta_content',$text); ?>
?>
Thread Starter
Eccola
(@eccola-www)
Thanks for the tips helgatheviking! I will try this, and certainly will read the plugin documentation this time.
sure thing. it probably isn’t in the plugin docu. it is a trick i learned when doing metaboxes with WP Alchemy. remember that WP does not save the paragraph tags in the database. it automatically applies them with the wpautop filter based on line breaks. so any time you want to your front end code to match what you see in the_editor you must run it through that filter.
thx helgatheviking, really saved my day with this solution 🙂