Why don’t you use apply_filters( 'the_content', $var );
when outputting your custom field? You don’t really want to save the extra paragraphs, otherwise you’ll end up seeing them when editing the custom field. This is not what happens with WordPress.
If you’re not happy with what the_content
does (it does a lot of things including wpautop
) then create a custom filter like this:
// Assuming $var is your custom field value
add_filter( 'my_custom_filter', 'wpautop' );
echo apply_filters( 'my_custom_filter', $var );
Cheers!
Related Posts:
- Add a Jquery Datepicker to custom field in post edit
- How to automatically apply woocommerce product title to all product images alt tags?
- WP doesn’t show Array Custom Fields?
- Add new “Insert Into Post” button with another function
- Correct Approach for Validating Custom Field Input
- Add meta data to the menu
- can you set a default value to a custom field
- Guest Author – How can I use custom fields to create guest author link?
- Add custom field to attachments in a specific category
- post meta data clearing on autosave
- How can update custom meta for all posts
- Add input field to ‘Pages > Edit Page’ through functions.php
- Add description text under input field for new profile fields
- How to add a predefined custom field without using a plugin?
- Populate Custom Field Dropdown on Theme Install?
- How to add content at the end of posts?
- Passing the custom field values in the wp_get_current_user array function
- how to put a custom field value in variable
- Auto Populate Custom Field with Complex Value That Increase by One?
- Custom Metabox Not Saving
- Getting the ID of any image for use in functions.php
- Auto-remove custom field with no value on publish
- Display custom field values from posts on frontpage
- get_post_meta not working on publishing
- Firing schema via code in functions.php doesn’t work
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- Which PHP page is the Default Posts Page
- Specific coditional usage [closed]
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- Why does this update_post_meta function not delete the custom field itself?
- How to show/hide php table rows based on the content of custom fields
- Get post meta retrieving wrong value
- Hide custom fields when empty
- How to disable Edit Post and Allow only Custom Field?
- Custom meta box values are not getting saved for my custom post type
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- WP All Import / Update stock quantity from multiple XML files
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- How to add data to a custom field at the wp_users table?
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Hide a div when a custom field is empty
- Let users upload image(s) to the post from front end
- Conditional On custom field plugin metabox
- Custom metabox not working
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Stripping and/or altering the content of a custom field (video URL)
- Display metabox title for custom fields with values
- Odd functions.php issue in WordPress
- simple fields plugin custom query
- Delete images from media library when user deletes an image from ACF Gallery
- Updating Metadata with Shortcode
- Products listing check if meta checkbox is checked
- Trying to update Woocommerce meta values
- Is it possible to update the dataset using update_post_meta
- Block error message in foreach loop when looping through ACF field
- Hide a div if the fiels is empty
- How do I get the value of a current user’s custom field?
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- How do I use foreach to get content from a custom-field in multiple posts?
- Function not pulling image or text from custom post type
- How can I hide my section title if there is no data in custom fields?
- Show message if statement is false – foreach
- How can I create a menu items from meta box based on users input
- Meta boxes not displayed, data isn’t being saved
- Calling Custom Field within Function wrapped with Divs.
- Retrieve IDs from custom field, count and display results differently according to count
- Get fields from metabox array
- Including inline Custom Fields info with add_filter in functions.php
- Display a custom field rating system in the front end
- Display custom meta box in my template file
- ACF Date fileds to Age Convert [closed]
- Foreach giving one too many list items, how can I remove the last empty line?
- How to automatically create a custom field when a post is published?
- Appending an ACF custom field to the page title
- How to pass value to add_filter wpcf7_form_tag from another function?
- Custom Admin Menu Report for Specific User ID
- ACF number less than comparison not working
- Exclude function for custom pages, exclude custom ACF fields
- Trying to establish connection to External Database
- How can I show custom fields in the loop only to specific user roles?
- get_posts that match a user-specified value on a page
- How to stop or remove an action being called inside a function of an extended class
- add_action shortcut?
- How to create html block to display extra information on woocommerce single product page
- Add conditional custom option to ‘Display name publicly as’ dropdown
- How to customize a permalink (URL) structure?
- Select multiple options in WordPress custom meta filed
- Custom fields not getting saved in the databse when added to the add new user profile page
- Display WP-Types custom fields in post [closed]
- Using fwrite() and “a” appends multiple times instead of once
- How to output a PHP file values by shortcode?
- Showing content from one page on another
- How to style options page in dashboard?
- I want to send an email when each post is published
- Creating a widget with a number of custom fields
- How to insert a single row to WP database table?