Home › Forums › Backend Issues (wp-admin) › My Custom Field Deletes Itself… › Reply To: My Custom Field Deletes Itself…
And if you remove the code then there is not problem?
what part of it causes the problem? If you comment out the load_field add_filter line does the problem go away?
To be honest, I’m really not sure by looking at your function why you would call it on the two hooks show_user_profile
and edit_user_profile
as these hooks are used to output HTML, which you’re not doing.
You might try looping through the posts of your query without using have_posts
, that will eliminate the query being the cause of the problem
function numediaweb_custom_user_profile_fields($user) {
$objekt = array();
$the_query = new WP_Query("post_type=immomakler_object&posts_per_page=-1&field=ids");
if (count($the_query->posts)) {
foreach ($this_query->posts as $post) {
$post_id = $post->ID;
$objektsave = get_post_meta($post_id,'objektnr_extern',true);
$objekt[] = $objektsave;
}
}
return $objekt;
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.