function wpcf_pr_admin_wpcf_relationship_save() { wpcf_pr_admin_wpcf_relationship_check(array('p')); update_post_meta($_REQUEST['post_id'], sprintf('_wpcf_belongs_%s_id', $_REQUEST['post_type']), intval($_REQUEST['p'])); die; }
function wpcf_pr_admin_wpcf_relationship_update() { wpcf_pr_admin_wpcf_relationship_check(); $post_id = (int) $_REQUEST['post_id']; $parent_post_type = sanitize_text_field($_REQUEST['post_type']); $data = array(); if (isset($_REQUEST['p']) && (int) $_REQUEST['p'] > 0) { update_post_meta($post_id, sprintf('_wpcf_belongs_%s_id', $parent_post_type), (int) $_REQUEST['p']); $data['edit_link'] = admin_url('post.php '); } else { delete_post_meta($post_id, sprintf('_wpcf_belongs_%s_id', $parent_post_type)); } wp_send_json_success($data); }