[wp-hackers] Post meta revisions
wp at andrewnacin.com
Mon Nov 29 20:00:18 UTC 2010
On Mon, Nov 29, 2010 at 1:15 PM, scribu <mail at scribu.net> wrote:
> On Mon, Nov 29, 2010 at 8:11 PM, John Blackbourn
> <johnbillion+wp at gmail.com <johnbillion%2Bwp at gmail.com><
> johnbillion%2Bwp at gmail.com <johnbillion%252Bwp at gmail.com>>
> > wrote:
> > Not sure about the best way to achieve this. Data in the post_meta
> > table is stored against post IDs, not post revision IDs, so this won't
> > work out of the box.
> > Any suggestions or thoughts appreciated.
> On the save_post hook:
> $wpdb->update( $wpdb->postmeta, array( 'post_id' => $rev_id ), array(
> 'post_id' => $post_id ) );
Metadata cannot be stored for revisions, but we only enforce that on the
*_post_meta() level. You can still use the *_metadata() functions to add
metadata to revisions.
More information about the wp-hackers