Compability update for wp-types
-
Hi and thank you for the great plugin!
It works like a dream, if you’re not one of the unfortunate depending on WP-Types (v.1.5.6) plugin.I battled for few hours to get the update mechanism to keep meta data intact.
Here’s what I found out:
- WP-Types uses save_post[1] to save meta fields, making the priority 100 solves this problem. After research couldn’t find negative effect.
- update_post() forgets post meta for some strange reason
My solution/changes:
line #45
add_action( 'save_post', array( $this, 'scadenza_save_postdata' ), 100 );
and on line #127 (Answer found from stackoverflow[2])
$wpdb->update( $wpdb->posts, array( 'post_status' => 'expiration' ), array( 'ID' => $cur_post->post_id ) );
These two small changes made the plugin work for me as expected.
[1] https://wp-types.com/forums/topic/update_post_meta-does-not-work-for-custom-fields/
[2] https://stackoverflow.com/questions/5573230/wp-update-post-make-custom-field-values-disappear-wordpress
- The topic ‘Compability update for wp-types’ is closed to new replies.