WordPress.org

Support

Support » How-To and Troubleshooting » Autosave problem with custom meta box

Autosave problem with custom meta box

  • Hi, i have make some custom meta box in my custom post type. I did not add any code for handling auto save (i don’t know how to). Now when the post is opened in browser and wordpress autosave it, it seem the data in the metabox which not change since last save is gone!! But the box which i have changed the data but not saved yet are saved.

    Can anyone say how do i handle autosave? Here is the code…

    function write_business_dir_options(){
    	global $post;
             $custom = get_post_custom($post->ID);
    		 $address = $custom["bus_dir_address"][0];
    		 $website = $custom["bus_dir_website"][0];
    ?>
    <p><label>Address: <?php $post->ID; ?></label></p>
    	<p><input type="text" size="50" name="address" value="<?php echo $address;  ?>" /></p>
        <p><label>Website:</label></p>
    	<p><input type="text" name="website" value="<?php echo $website; ?>" /></p>
    <?php
    }
    
    function save_business_dir_options(){
    	global $post;
    	 update_post_meta($post->ID, "bus_dir_address", $_POST["address"]);
    	 update_post_meta($post->ID, "bus_dir_website", $_POST["website"]);
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Autosave problem with custom meta box’ is closed to new replies.
Skip to toolbar