[wp-trac] [WordPress Trac] #25023: WordPress 3.6 deleting data on custom post meta
WordPress Trac
noreply at wordpress.org
Wed Aug 28 18:34:02 UTC 2013
#25023: WordPress 3.6 deleting data on custom post meta
-------------------------------+------------------------------
Reporter: cdwharton | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 3.6
Severity: critical | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Comment (by WraithKenny):
I was able to reproduce.
SVN'd a local WP 3.5.2 and configured vanilla, running on xampp
logged in, edited default theme with the theme editor.
{{{
/* #######################################################################
Custom Meta for bugs
####################################################################### */
function bug_init(){
add_meta_box("bug-meta", __("Enter Something in
here"), "bug_meta_options", "page", "normal", "high");
}
function bug_meta_options(){
global $post;
$custom = get_post_custom($post->ID);
$bug = "";
if( isset( $custom["bug"] ) ) {
$bug = $custom["bug"][0];
}
?>
<div>
<div style="padding: 10px 0;"><i><b><?php _e("Enter
whatever you want in here."); ?></b></i></div>
<input class="large-text" type="text" name="bug" id="bug"
value="<?php echo $custom["bug"][0]; ?>" /> <br />
</div>
<?php
}
function save_bug_meta(){
global $post;
if (isset( $post->post_type) && $post->post_type == 'page' ){
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post->ID;
} else {
if( isset( $post->ID ) ) {
update_post_meta($post->ID, "bug",
$_POST["bug"]);
}
}
}
}
add_action("admin_init", "bug_init");
add_action('save_post', 'save_bug_meta');
}}}
Added to bottom of functions.php
Edited Sample Page to add meta
Upgraded
Visited page, clicked Edit on menu bar
Meta was blank.
(Subsequent meta edits stuck tho.)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25023#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list