How To Tell If a Custom Field Was Made with ACF, Metabox.io, Carbon Fields, Custom Built, etc?

I am working on a plugin that will be using custom fields, but was curious if there was a way to tell which pluginlibra

I am working on a plugin that will be using custom fields, but was curious if there was a way to tell which plugin/library created those custom fields. The reason I am trying to find this distinction is so I can use the correct function when getting the data for these fields, so for ACF I'd use get_field() for Metabox.io I would use rwmb_meta and if they were custom built I would use get_post_meta(). I was looking in my database to see if I could find anything that was distinctive for each custom field, but nothing jumped out at me.

Is there any way to tell what plugin/library created a specific custom field?

I am working on a plugin that will be using custom fields, but was curious if there was a way to tell which plugin/library created those custom fields. The reason I am trying to find this distinction is so I can use the correct function when getting the data for these fields, so for ACF I'd use get_field() for Metabox.io I would use rwmb_meta and if they were custom built I would use get_post_meta(). I was looking in my database to see if I could find anything that was distinctive for each custom field, but nothing jumped out at me.

Is there any way to tell what plugin/library created a specific custom field?

Share Improve this question asked Jul 6, 2019 at 23:34 user9664977user9664977 3875 silver badges12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I am working on a plugin that will be using custom fields, but was curious if there was a way to tell which plugin/library created those custom fields.

WP doesn't store any meta information in the database about post meta and what plugins touched it. WP doesn't sandbox plugins at all, so once they're loaded it's all considered code. As such WP core code is on an equal footing with any plugin code

The reason I am trying to find this distinction is so I can use the correct function when getting the data for these fields, so for ACF I'd use get_field() for Metabox.io I would use rwmb_meta and if they were custom built I would use get_post_meta().

You may be able to use the APIs of each respective plugin to fetch the fields registered and compare them, but you would need to write code that relies on knowing internals of how those plugins store data. You would need to raise this with dev support for each plugin you hope to support.

I was looking in my database to see if I could find anything that was distinctive for each custom field, but nothing jumped out at me.

That data simply isn't stored in the database, and WP itself makes no attempt to store it. You would have to ask the plugin authors via their support channels.

Is there any way to tell what plugin/library created a specific custom field?

No, not using WP functions and APIs.

It might be that ABC Example metabox library uses post meta keys prefixed with abc_ that you could use, but that's if you're lucky. Or that XYZ library makes you register fields via PHP, and their keys and values have predictable formats. You'd have to ask them.


Sadly you didn't provide any context as to why you're trying to do this, so it's difficult to advise what to do. Just keep in mind that all of them are readable using get_post_meta. The APIs such as get_field are all wrapper functions around get_post_meta that add extra logic.

Keep in mind though, that 3rd party plugins are offtopic here, you can't ask ACF specific questions etc, and this wouldn't be the best place to ask those questions either

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745340123a4623287.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信