You can get the content with $_REQUEST
, Try the below code:
add_action('publish_post', 'save_content_to_field');
function save_content_to_field($post_ID) {
if(isset($_REQUEST['content'])) {
update_post_meta($post_ID, 'desc', $_REQUEST['content']);
}
}
UPDATED
With the below code if you want to sore with shortcode support:
add_action('publish_post', 'save_content_to_field');
function save_content_to_field($post_ID) {
$post = get_post($post_ID);
$result = apply_filters('the_content',$post->post_content);
if($result) {
update_post_meta($post_ID, 'desc', $result);
}
}
Related Posts:
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- More efficient to add content to custom fields or the content area?
- Filter post style attribute
- How to add content with a filter when there’s no content in the editor
- Empty the_content for all posts
- Include custom fields into the content of a regular page
- custom field output after the_content
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Individual Widgets per Page
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Add custom fields to search
- How to add add_meta_box to specific Page Template?
- Apply the_content filter to a custom field with multiple values
- How to get users by a custom field / by user meta data?
- Auto sort the wp-admin post list by a meta key
- extend Meta Box / Document Panel
- Add multiple images to a page sidebar
- getEntityRecord without knowing the post type
- Get updated meta data after save_post hook
- Add custom field to image editor
- Show User Their Password
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- How to reload the role specific registration form on validation errors?
- How to break meta values into different items and avoid duplicates?
- ajax delete value from custom field array
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- How can I query on the year part of a complete date in a custom field?
- Currency (price) formating on custom fields
- Gravity Forms: Create fields programmatically
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- Order by value in serialized custom field
- Custom image sizes for custom field media uploads
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- What is the cleanest way to extract custom variables from a post
- Add source URL from Feed WordPress (Syndication) plugin to a custom field in post editor
- List custom taxonomy terms from custom field
- How do I create a column in Users list and display user data from custom registration field
- How to add posts through CSV or excel file in a PHP file
- Modifying custom order item meta from admin order view
- Can’t display errors in attachment_fields_to_save
- Customizing WP user profile with custom fields
- Custom Field 101
- When creating a metabox do you have to create DB fields for the data?
- Using abs() with custom field in orderby statement
- Can’t save custom field on registration page
- Best filter to use for modifying custom fields on a post?
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- Is it preferable to use custom code to create metaboxes instead of plugins (such as ACF) and if so why? [closed]
- Function that replaces the image in the absence of the post meta
- Is there a way to set default custom fields when creating a new post?
- WP Cli – post add meta in xargs after wp post generate – add multiple fields
- Anyone know how to use ACF and show custom fields for logged in users only on a post? [closed]
- Add custom column for custom field
- ul list with only as many li’s as filled custom fields
- Is there a way to dump all registered sidebar/widget?
- How to hide post meta
- ACF Plugin How to make the customer add more fields in the post?
- custom field in admin columns
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- get_post_meta returns 0
- Populate wordpress menu with link to custom field value (file download)
- Selectively hiding or allowing thumbnails of featured images on front page
- Custom field bug in WordPress 3.2
- Users uploaded image and matching an id or taxonomy
- Adding data to User profile
- How can I change author of posts to the value of one of the custom field of the posts?
- Let any visitors delete a post if they know Id nr & password?
- Is it possible to add Term Meta Fields to a WooCommerce Attribute?
- update a custom field with the value of another existing custom field
- Post meta data not showing in frontend, until hitting ‘update’ button
- Ordering posts by custom fields (Date)
- register_form, custom field not submitted on first try
- PHP and Shortcode Combination
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- How to properly get popular Posts by multiple Values
- Query Custom Fields in Searchform
- Make custom user_meta as permalink for post
- Creating Structured Documents (books) in WordPress?
- Filter query based on date in custom field
- Get custom fields when hover link of post
- WP Query multiple select form – meta_query help
- update_post_meta not working in action hook
- Group pages by custom field values
- Convert many posts from having a specific meta_key to use a post_format
- Custom fields: my custom checkbox area doesn’t seem to work
- get_post_custom_values not working
- How to create Parent-Child relation for custom fields?
- How to check if custom field exists in this widget query
- display loop only if a post meta data exist
- How do i output images from URL’s added to the same custom field key
- Add Custom field under the post title [closed]
- Check if a field is capitalized?
- Filter Query Post by Custom Fields(by date)
- Can’t sort custom column on user.php by number / meta_value_num?
- Need to call this php function inside a modal window from text widget
- add multiple values (array) to post meta_input