WP Editor to post meta – no paragraph tags
-
Hi, I’m trying to add a bibliography field to my post/edit page as a wp_editor() (rich text/HTML) field. However, when it gets saved as a post meta custom field, it all gets collapsed into one paragraph – italic formatting, links, and that sort of thing stick around because those get translated into
<em>and<a>tags from the rich text, but<p>tags aren’t generated. How can I fix this so that I’m able to have bibliography items on separate lines?Here’s my code:
add_action( 'edit_form_advanced', 'reference_editor' ); function reference_editor() { // get and set $content somehow... echo ""; echo "References"; echo ""; $settings = array( 'wpautop' => true, 'media_buttons' => false ); wp_editor( get_post_meta(get_the_id(), 'references', true), 'references', $settings); echo ""; } add_action( 'save_post', 'save_post', 10, 2 ); function save_post( $post_id, $post ) { if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id; update_post_meta( $post_id, 'references', stripslashes( $_POST['references'] ) ); } -
Hi @rmaxfiel, can you confirm what site you’re working on? It sounds like you’re likely developing using your own installation of WordPress.org, and these forums are actually for the sites hosted on our servers.
Our service is different from the free software project. So for help with the free software, I’d recommend checking the support forum here:
https://wordpress.org/support/forums/Good luck!
-
My apologies, yes, this is for a local installation. I could have sworn I’d posted this in .org support but apparently not. Thank you!
- The topic ‘WP Editor to post meta – no paragraph tags’ is closed to new replies.