Home › Forums › Backend Issues (wp-admin) › My Custom Field Deletes Itself… › Reply To: My Custom Field Deletes Itself…
Hi John,
thanks for your fast answer, but I still have the same issue. My code looks now this way:
function numediaweb_custom_user_profile_fields($user) {
$objektsave = array();
$the_query = new WP_Query("post_type=immomakler_object&posts_per_page=-1&field=ids");
if ($the_query->have_posts()) {
global $post; // not sure if you need this or not, try it with and without
while ($the_query->have_posts()){
$the_query->the_post();
$save = get_the_ID();
$objektsave = get_post_meta($save,'objektnr_extern',true);
$objekt[] = $objektsave;
}
wp_reset_postdata();
}
return $objekt;
}
add_action('show_user_profile', 'numediaweb_custom_user_profile_fields');
add_action('edit_user_profile', 'numediaweb_custom_user_profile_fields');
/// DATA IN ACF
function acf_load_auswahlfeld_field_choices( $field ) {
$objekt = numediaweb_custom_user_profile_fields();
$field['choices'][] = $objekt;
return $field;
}
add_filter('acf/load_field/name=immoid', 'acf_load_auswahlfeld_field_choices');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.