From 26b8226d5daa05dfa39ebc7e40ebffc1b34ccf46 Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Tue, 6 Sep 2016 19:54:01 +0800 Subject: [PATCH] Fix role options in radio field --- core/um-fields.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/um-fields.php b/core/um-fields.php index 9f9747a8..1e7701e2 100644 --- a/core/um-fields.php +++ b/core/um-fields.php @@ -1801,7 +1801,9 @@ class UM_Fields { foreach($options as $rkey => $val ) { $val = (string) $val; $val = trim( $val ); - $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'um_role' AND post_title = '$val'"); + $post_id = $wpdb->get_var( + $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'um_role' AND post_name = %s OR post_title = %s", $rkey, $val ) + ); $_role = get_post($post_id); $new_roles[$_role->post_name] = $_role->post_title; wp_reset_postdata();