Skip Navigation

[Resolved] Warning: field slug already used

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 10 replies, has 2 voices.

Last updated by kellyR 4 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#1521657

I am trying to ad a custom field "services" for a post type "business".
This is when I get a warning: "Warning: field slug already used"

Looked at all related tickets including those stamped as 'resolved' but still need advice so I'm posting here.

I had previously added the custom field "services" to "User Fields".
Then deleted it through "Post Fields Control".
Now I get the error above.
I looked within the database options "wpcf-fields" contents and found NO reference to "services".
Is there another place in the DB to check?

I cleared all caches, flushed my router, my browser, alternate browser, bypassed cloudflare, rebooted my server, re-logged into my site, etc...
I am still getting the warning when I try to add the custom field "services" as above.
Please can you advise what or where to look for an answer to this?
Thank you so much for your kind help.

#1522299

When you get that warning it means there is already something using that term and you'll have to change the slug of that field.

If you deleted the field in the Fields Controls screen, really deleted it, it cannot be there anymore. I tested this locally, it would hence mean that if this is the case something stops from deleting that field on the specific site you use.

This is possible, but more often than not, there is another field somewhere still saved.
If you head to Post Fields control you cannot see that field? If not, then it is something under the hood blocking from saving.

Indeed the fields of types are saved as meta BUT also as options, so that is where it'd be conflicting if still somehow existing, but before editing the database I would rather suggest we understand why and what is happening and try to resolve it at the core.

Can you try a few basic steps to exclude some simple causes?
1. Test with another theme and no other plugins but Toolset
2. Make sure in posts fields control no instance of that field is still visible (check the slugs)
3. If still there, delete it
4. If then the issue still happens, maybe it is possible to locate this field in the other (user, post, term) field groups?

Please let me know the outcome and if help will still be needed, please also attach:
- access to the site
- access to MySQL
(Best, all of this on a test site duplicate, if possible)

I can then analyse this directly and maybe check in the database what's going on. I'd not yet make any changes without informing you prior.

Note that sometimes also words are used by WordPress or other software and then the same error might happen.

#1522725

Hi Beda, thank you for your response to my problem. Please read my post to see that I have done all of those tasks and also de-activated all other plugins. As I mentioned I did not find "services" in Post Field Control or in "wpcf-fields" in the database. I guess the more direct question is; where does Toolset look to find this entry and what procedure creates this error? Also in the DB I found "services" in "usermeta" ...
(816, 'wpcf-usermeta', 'a:9:{s:8:\"services\";a:8:{s:2:\"id\";s:8:\"services\";s:4:\"slug\";s:8:\"services\";s:4:\"type\";s:8:\"textarea\";s:4:\"name\";s:8:\"Services\";s:11:\"description\";s:39:\"Short description of services provided.\";s:4:\"data\";a:7:{s:13:\"slug-pre-save\";s:8:\"services\";s:11:\"placeholder\";s:0:\"\";s:18:\"user_default_value\";s:0:\"\";s:10:\"repetitive\";s:1:\"0\";s:10:\"custom_use\";s:0:\"\";s:19:\"conditional_display\";a:0:{}s:16:\"disabled_by_type\";i:0;}s:8:\"meta_key\";s:13:\"wpcf-services\";s:9:\"meta_type\";s:8:\"usermeta\";}
Should this be removed?
Thank you!
Kelly

#1526493

Hence that field saved as User Meta is not been deleted, but this should still not generate conflicts with a new such post meta.

Please don't remove that Database entry, I suggest instead to provide me with a copy of the site so I can test and then instruct precisely what to do.
https://toolset.com/faq/provide-supporters-copy-site/

I opened a private reply

#1527685

Beda, thank you so much for your efforts but I didn't want to wait or make a project out of this so I deleted the orphaned items in the DB. After all this site is my own test site for evaluation of a new project. Anyhow I will try to make it clear for you what has transpired as it may be useful to you or others having the same issue with Toolset.

I had created custom fields 'email', 'phone' and 'services' related to a custom post type 'business'.
I deleted these fields at the 'Post Field Control' page.
After that I decided to re-add the 'services' field again but got the error "Warning: field slug already used" as stated above.
But the fields did not show up on the 'Post Field Control' page, as they were removed.
BUT they did show up in the 'wpcf-usermeta' table within the 'options' table, and only those showed.
I deleted the 'wpcf-usermeta' table and had not problem adding fields after that.
Probably not the right thing to do if this was an operational web site but got the info needed to replicate the problem.
It looks to me like removing these orphans would solve the problem.
Hope that helps.

#1528137

Yes, this solves the problem, because then Types does not receive any matches on existing fields.
Why though this happened remains unclear, locally I cannot replicate such a scenario.

Please let us know if this happens again, as well anyone else seeing such behaviour.

Unfortunately, it is impossible for me to define closer how it happened - but I do not suspect a BUG in Toolset, because I haven't' yet experienced the issue myself and also not seen other reports matching this.

The thing is, user fields entries in the database can only be created if you create user fields.
Otherwise, no such entry can be made.
I went thru the steps of creating a user field named services, and I stand corrected about Types not complaining about the same name if then you create that field in posts fields.
It does complain, it states "Warning: field slug already used" even that field is a User field and now I create a Post Field.

And here there is a potential issue maker:
When you now go and delete that USER field, you would intuitively go to Toolset > Custom Fields > Post Fields Control. But that's wrong.
You'd have to first delete the User Field in the User Field Group, then go to Toolset > Custom Fields > User Fields > User Fields Control and delete the User Field from there.

So that is the only way I can imagine how this happened, but you mention you never used User fields, hence it remains unclear how the situation was even produced

Please let me know if you have further details on this, or can see the issue again, otherwise, I think we can call it "solved", even if we do not precisely know why. This is, of course, unusual, I generally like to know why things are solved, but in this case, it seems an exception.

#1529017

Thank you so much Beda for your quick reply.
BTW this website uses PHP 7.2 and WordPress 5.3.2.

I cannot absolutely say that a "services" field was not entered for Users as that was days ago and my memory is not clear.
As you say, it must be the case and the field could even have been re-named for that matter.

My last question is, if any problems could occur by deleting the 'wpcf-usermeta' row totally as I did?
What would proper procedure be to remove the orphans?

#1530149

That is the only chance I see for this to happen, yes.

Now about deleting the wpcf-usermeta row in the wp_options table, basically means you deleted all user custom fields ever created with Toolset on this site.
The groups will still appear but would miss any fields in them.

So if you have NO Custom Fields Groups in the Toolset > Custom Fields > User Fields tab, it means you had no group there and then you should be fine deleting that user meta row.
It is not the standard approach, of course, usually, you'd do this in the WordPress Admin, it is exceptionally a possible solution in this case.

#1530693

Last thing for those who experience this issue is that if you delete the 'wpcf-usermeta' row it will be replaced when a new user field group is added through the Toolset custom field interface. So far I have had no further issues on this subject.

#1531583

Yes, this will be created again if you create new User fields.

Thanks!

#1534771

May as well close this ticket.
Hopefully it will help someone else.