Hi @absolutejdx I’m not sure what’s going on there with your site, in large part because outside of having checkbox toggles to enable custom field support, CPTUI doesn’t do anything with post meta data. I have to believe that at the moment, it’s something else within your setup that is doing this. May be especially true if you’re using a different plugin for the metaboxes instead of the out-of-the-box version for custom fields. That one would be the dropdown/input to set a key on the left and then the text field on the right to set the value.
Internally, WordPress ignores keys with _’s in them from that default metabox, and treats them as “hidden” value.
?? CPT UI creates meta data. That’s what the custom fields are. I just need it to stop adding the underscore when it’s creating the keys.
No, I’m saying we don’t create/touch meta data. The closest we come to the topic is just telling WordPress “hey, this post type should have meta data support”. Whatever is forcing underscores on your keys is coming from something else in your website.
Let me word this differently. When I add a custom field using CPT UI and then I go into my PHP admin console the field key created by CPT UI has an underscore added in front of the field key I typed. This is only happening with CPT UI I can manually add keys in my php console it does not happen. I can also add fields and keys with other plugins and it does not happen. I think CPT UI is recognizing that the field key already exists and is adding the underscore when creating the new key.
Can you provide a screenshot of the place you’re adding your meta keys, for the ones that are getting prefixed? I have to believe this is either a custom plugin providing some UI for meta data, or possibly something from your active theme.
Is this PHP admin console something that you installed from somewhere else? or is it perhaps from your hosting provider?
I don’t know what’s going on yet with this situation, but I know definitively that our plugins does not do anything with meta data, we have no place that uses any of these: add_post_meta, get_post_meta, or update_post_meta. We also don’t do any sort of scanning of meta keys to check if they exist somewhere, and at a technical level, WordPress supports the ability to have multiple meta keys with different values. Unless I’m somehow mistaken, that would include keys that have underscores in front of them.
Just because it’s happening with a post type added via CPTUI, doesn’t mean it’s CPTUI causing anything. I would wager if you registered a post type manually and used the same meta data entry method, the same would happen with that post type as well.
I’m willing to help as best I can, but I also know what CPTUI is doing in its code 🙂