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 add category to: ‘wp-admin/post-new.php’?
- Setting Custom Sort Order of Posts within a Category
- Can I force a metabox to be in one column?
- Custom permalink structure only for default posts
- Exclude drafts in all() view of edit.php
- upload image in a meta box
- Change slug with custom field
- adding a custom css class to post
- Prevent duplicate posts in wp_insert_post using custom fields
- Better post meta efficiency?
- Add default content to post (for specific category)
- Human Time Diff, change mins to minutes
- Adding Multiple Values to a Post Meta Key
- display order of connections
- same template for multiple custom post type single
- How to place HTML below the title of the (custom) post overview
- How to get a nofication when post submitted
- .current-menu-item class on custom post type children pages – again?
- Display page content AFTER a loop of posts
- Run a function when post is deleted?
- Checking if a post with certain meta value exists
- How can I create custom button in post.php
- how to replace embedded “full” sized images within a post with the “large” ones
- Downgrade user from role that allows post creation
- Save re-arranged draggable post items to wordpress database
- Animated gif for a thumbs
- I am unable to publish/update post
- Get posts of ONE taxonomy term of custom post type
- WordPress Custom Fields (Checkboxes with multiple values)
- is there a way to show the the post title after the image?
- Custom Post Archive Page not working
- Adding buttons to Add New Post and Add New Page
- WordPress custom Query for Posts in Category display posts multiple times
- Editing the default page to show all posts, rather than most recent ones
- 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
- Cannot retrieve a custom RSS field from posts
- Saving custom fields to a custom taxonomy
- Custom post types related to same custom post type?
- Format latest/newest post differently
- Using setup_postdata() with multi-dimensional array
- Check if a custom post type has already been created
- Let’s Create Custom Field Template Documentation
- Show metabox value last post excerpt, title and link
- Add multiple meta keys to a post at once
- Show number of posts by logged in user
- Get post related to particular meta box? [closed]
- Insert data from custom created PHP page into wp_postmeta table
- Change default post style to columns
- Post titles and thumbnails as links to custom post types?
- Custom Post Type, post-formats associated to custom post type > 404 archives
- Delete post from admin but not from database
- Custom Select Query – Selecting the Year?
- What would causes search to return incorrect results?
- Select another post in a post meta like a parent page is selected while editing a page
- Tag for custom post type
- Blogposting Schema & Structured Data without plugin
- Add postmeta to all blog posts
- Manual Scheduler For Custom Post Type
- Dev and prod on the same database- dev version active for IOS
- How to delete/customize imported demo content from a theme or add my own?
- How to fetch posts that are stored in the different table than the default table (wp_posts)?
- Displaying dynamic content (blog posts/portfolio) on a static homepage and keep the blog post styles
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- Filter question list on substring of metavalue
- How can you control what a user is allowed to post in the backend?
- How to list all names and descriptions of a custom taxonomy
- Edit post meta direct from post.php?
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Show a Category Specific Info Box
- Make a custom URL and link to custom Template
- Special Query: Title, Terms, Content – %LIKE%
- WordPress 3.2 – Problem with WYSIWYG editors in a custom post type?
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Only show posts belonging to multiple cateogries at same time
- How do I get content of custom post type through post ID
- WordPress Custom Post type csv exporter
- Edit Page button is gone