Related meta disappears after wp_update_post()
-
First of all: thanks for the plugin.
Now the problem: calls to standard WP function wp_update_post() reset any related field content. I.e. the Simple Page Ordering plugin reset all related fields every time you re-order (with drag&drop) your pages!I think the problem is method save() (lines 118-130 in current version). The condition:
if (!isset($_POST['related-posts']) || empty($_POST['related-posts']))
is always true if the update is a low level update, via wp_update_post(). The line above delete the meta.Probably the code should delete the content destination only if the $_POST[‘related-post’] is set (and empty).
if(isset($_POST['related-posts'])){ if (empty($_POST['related-posts'])) : delete_post_meta($id, 'related_posts'); else : update_post_meta($id, 'related_posts', $_POST['related-posts']); endif; }
Ciao;
Matteo
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Related meta disappears after wp_update_post()’ is closed to new replies.