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
- How do I know what variables are passed in a filter/action and what their meaning is?
- Add before_content and after_content to register_sidebar
- How to update a meta field of type array in Gutenberg
- Custom field as Slug
- responsive.css in the WordPress should be prioritized
- How to hide a div based on contents of custom field
- Get all the posts where meta field with multiple choice has several values checked
- CSS change in woo commerce Place Order Text [closed]
- Can’t log in to WordPress wp-admin after adding code to functions.php
- I got big white screen when i attach main style sheet of Html in functions.php
- Change custom rewrite rule when permalink is updated/changed
- automatically add custom fields to post title
- will wp_insert_post write a new custom field to the database?
- Display Content Based on Custom Field Value
- WordPress rating by views [closed]
- Custom field in title
- Remove default Image Sizes
- A better way to write this php function
- change title of page dynamically