Home › Forums › Backend Issues (wp-admin) › Duplicate fields displayed
Hi Elliot,
I’m having a problem with mysterious duplicate custom fields. This problem seems to have arisen since I installed WPML and translated the site and only happens in certain languages.
Here is a copy of the registered field groups in a gist.
I did read the little caveat here:
However, this may result in errors if the array is not compatible with ACF
and was wondering if my editing the field locations to work with WPML isn’t responsible for these errors? There is a function that I can use in the array in order to include the page and its translations but it requires rewriting a fair amount of the theme and I’d rather not if I can help it.
Many thanks,
Kirsten
Can you please elaborate what you mean by:
“mysterious duplicate custom fields”
Have you tried simplifying your code to just include 1 field group? Does it work correctly? Then add in the next field group? What about now?
Thanks
E
Looking at your GIST, I cant find any reference to Manchettes. Is it possible that you have field groups registered via code and also registered in the DB?
Please note that this will cause duplicate fields to appear.
Is this a possibility?
Thanks
E
Hi @elliot,
Yes this is the connection with WPML both “Manchettes” and “FAQ” were created upon translating “Headlines” and “FAQ”. I’m not quite sure what you mean about them being registered in the DB. I did look for the fields in the DB hoping to simply delete them but I couldn’t find them. I assume they are in postmeta and did a search for the field id but only found one entry. I think we’re on the right track though. I’ll also have a look at the WPML tables. Can you tell me specifically what to look for as I’m guessing “Headlines” is buried in an array.
In the wp-admin, navigate to the Custom Fields menu item. Are any field groups visible in the edit table? If so, these are the field groups in the DB.
You will need to trash each field group that you are registering via PHP.
Hope that helps.
Thanks
E
Hi @elliot,
Ah, I haven’t included the plugin (as a plugin) in the theme so I don’t have it as a menu item. I am fairly comfortable with php-my-admin though so I’m just going to go and see what’s in there.
I’ll keep you posted.
Thanks,
Kirsten
Update: I think I’ve found the problem. I went through php-my-admin and queried post_type LIKE %acf% and found several entries. I must have imported them as a custom post type when I migrated from local to staging. I presume I can just delete them? Please confirm.
To see the ACF admin screen, just comment out the ‘define acf lite_mode’ code in your functions.php.
Yes, if you remove those wp_post rows, then you will only load data from the PHP code and avoid duplicates
Thanks
E
The topic ‘Duplicate fields displayed’ is closed to new replies.
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.