Iterate over get_post_meta() result
-
I have WordPress code like below.
function get_preselect_values() { $volunteers = get_post_meta($_POST['element_id'], "volunteers", false); $users = array(); foreach ($volunteers as $volunteer) { foreach ($volunteer as $volun) { $users = $volun['ID']; } } echo json_encode($users); die; } add_action('wp_ajax_get_preselect_values', 'get_preselect_values'); add_action('wp_ajax_nopriv_get_preselect_values', 'get_preselect_values');
I am getting only the First value.
How can I get all values ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Iterate over get_post_meta() result’ is closed to new replies.