This is because save_post hook function accepts post id as parameter and not post object so the save_custom_meta function should be as following.
/** Save the Data **/
function save_custom_meta($post_id) {
// verify nonce
if (!wp_verify_nonce($_POST['shortdesc_meta_box_nonce'], basename(__FILE__)))
return $post_id;
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return $post_id;
// check permissions
if (!current_user_can('edit_post', $post_id))
return $post_id;
//echo $_POST['_desc'];
//die();
if(isset($_POST['_desc']))
update_post_meta($post_id, '_desc', strip_tags($_POST['_desc']));
}
add_action('save_post', 'save_custom_meta', 1, 2);
Related Posts:
- How can I retrieve multiple get_post_meta values efficiently?
- How to batch update post content with custom post meta value
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Using radio button meta data from a custom meta box
- Using Custom Posts with Metaboxes and Drop-downs
- Adding custom fields to bbpress reply form
- Meta value does not save for scheduled posts
- Getting value from get_post_custom
- Calling Different Custom Post Timestamps in a table
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- How to save meta checkbox WordPress
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- if in category but only with post meta
- Updating post meta for checkbox
- How can I tell if a post has been published at least once?
- Adding a meta box to determine the sidebar [closed]
- How to bulk Update URLs to new values?
- Adding an option to post editor to show a site disclaimer or message
- Meta boxes not saving
- Display metabox with date
- How to compare two posts including their meta fields on a scalable base?
- Permission issue with custom post type – not added to menu – by plugin
- Duplicate Custom Post Type and Taxonomy Slug
- How could I change my Permalink from blog to custom structure? [closed]
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Take a received feedback item, turn it into a post
- WP Admin register taxonomy and post type performance
- Add a custom meta box in the post options that loads some html code in the header
- Static posts page with home.php
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Admin – create custom post status and display above table
- Simultaneous admin updates causes custom fields to not update
- Is it possible to paste a link without tags and make it directly a link in a post?
- custom post template file not shown, instead all the time 404.php
- Set Default Category to Username
- How to allow visitors to filter posts by multiple taxonomies
- Cannot retrieve a custom RSS field from posts
- show custom post type category dropdown sorting result on same page
- Custom Post Type Rewrite To Include Parent Page(s)
- Thumbnail & Category link aside post
- Saving custom fields to a custom taxonomy
- How to automate featured posts number? [duplicate]
- How to include my own css in post
- Custom post types related to same custom post type?
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- Dynamically switch template on click
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Is it possible to customize the post according to post format in single.php?
- Change all author links in Blog roll
- a little direction on custom post type
- disable Tab post on nav-menus page (Admin)
- How to calculate the average of a post meta value(Numeric) of a specific author
- Format latest/newest post differently
- Custom taxonomy archive page problem
- Is there any way to tell when wp_postmeta has been updated?
- Tell WP to use a specific template file in posts
- Hide custom metabox value from custom fields
- relating business and products with custom taxonomy?
- Best Way to Add UnEditable HTML to Posts
- Get post meta retrieving wrong value
- How safe is it to delete old posts edits to save database space?
- Two Custom Post Types with Identical Articles Competing for the same Slug
- Custom Post Type archive
- WordPress custom post type with folder structure in slug
- wpColorPicker – problem with implementation to post meta
- Using setup_postdata() with multi-dimensional array
- Is codex right on deleting post?
- Check if a custom post type has already been created
- WordPress Query Posts From Category Post on Static Page
- Edit multiple custom post types while saving a new or edited post
- Let’s Create Custom Field Template Documentation
- Upload attachment from external site
- Create a custom posts page
- Change post author without using wp_update_post()
- Show metabox value last post excerpt, title and link
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- How to get different Related Posts
- How to add convenient buttons for new custom post statuses
- wp_query with ajax
- Update post meta within save_post action
- How to allow multiple thumbnail upload for Posts?
- Display post number by category
- add external project to web site wordpress on production
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- Saving Post Data in Another Database
- Show custom post with custom categories with specific slug
- register_post_type permalink
- Display the 2nd category name of a custom post type without error if its null?
- Auto delete posts based on content text
- How to call posts under a specific category on static front page?
- Querying another post category to match current post and display in loop
- Custom home page with full post for first one only
- Custom Post Limit for homepage only without plugin?
- Custom permalink for each post
- Is there a way getting post fields using `transition_post_status`
- Automatic blog page with custom design [closed]
- Display value of custom field at the beginning of a post
- Add multiple meta keys to a post at once
- Show number of posts by logged in user