Title: Get a Field Group&#8217;s locations programmatically
Last modified: June 29, 2023

---

# Get a Field Group’s locations programmatically

 *  Resolved [Mark Woodard](https://wordpress.org/support/users/woodardmc/)
 * (@woodardmc)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/get-a-field-groups-locations-programmatically/)
 * Hello,
 * I’m working on an integration with meta box that will let users pick Meta Box
   field groups and fields from a selector. After selecting a field, it’s contents
   would displayed on the page.
 * I’m stuck on displaying fields that are attached to a settings page though. To
   display a field from a settings page you need the “option name” for the field
   group it’s in.
 * I don’t know what meta boxes might be on any given site. So I’ve been getting
   the field groups with the `rwmb_get_registry( 'meta_box' )->all()` function. 
   This gets me all the field groups and their settings. But there doesn’t appear
   to be a way to get what locations or, in my case, settings pages that the field
   group is on.
 * without getting the settings page that a field is on, I can’t get the option 
   name and I can’t display it.
 * Do you have any suggestions for how I could get these option names programmatically?
   Any help or guidance would be greatly appreciated.
 * Thank you,
 * Mark

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Anh Tran](https://wordpress.org/support/users/rilwis/)
 * (@rilwis)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/get-a-field-groups-locations-programmatically/#post-16937803)
 * Hi [@woodardmc](https://wordpress.org/support/users/woodardmc/)
 * Sorry for the late reply.
 * In the meta box object that you get through the `rwmb_get_registry( 'meta_box')-
   >all()`, the object type will define what type of the object this meta box is
   for. If for settings page, then `$meta_box->get_object_type() === 'setting'`.
 * You can get the setting pages ID via `$meta_box->settings_pages`. All settings
   pages are added via the filter `mb_settings_pages`, so you can loop through it
   and find the settings page with the corresponding ID, and from that get the option
   name.
 * Hope that helps,
   Anh
 *  Thread Starter [Mark Woodard](https://wordpress.org/support/users/woodardmc/)
 * (@woodardmc)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/get-a-field-groups-locations-programmatically/#post-16939468)
 * [@rilwis](https://wordpress.org/support/users/rilwis/)
 * Thanks for the pointer! 
   I’ll give that a try and let you know if that works 
   out for my case.
 * Mark

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Get a Field Group’s locations programmatically’ is closed to new replies.

 * ![](https://ps.w.org/meta-box/assets/icon-128x128.png?rev=1100915)
 * [Meta Box](https://wordpress.org/plugins/meta-box/)
 * [Support Threads](https://wordpress.org/support/plugin/meta-box/)
 * [Active Topics](https://wordpress.org/support/plugin/meta-box/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meta-box/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meta-box/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Mark Woodard](https://wordpress.org/support/users/woodardmc/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/get-a-field-groups-locations-programmatically/#post-16939468)
 * Status: resolved