Closed prconcepcion closed 5 months ago
Hi @prconcepcion ,
Do you mean "metadata" = the settings page's settings or the field settings?
@rilwis, sorry I was not clear but I meant settings page's settings
If there is also a way to obtain the settings page's settings through the setting's page id, that would also be nice.
@prconcepcion
This is a quick & dirty snippet that you can use to get the settings page's settings from option name or ID:
$settings_pages = apply_filters( 'mb_settings_pages', [] );
foreach ( $settings_pages as $sp ) {
// if ( $sp['id'] == $id ) {
if ( $sp['option_name'] == $option_name ) {
// Do something with $sp
}
}
You can extract it into a helper function to reuse it later.
Issue Overview
This is not really an issue but more of a question. So when I do something like this:
$fields
would return an array of settings with fields it contains. The key of each setting is theoption_name
. Is there any way I can obtain the metadata of the setting through theoption_name
? Because I wanna display the setting's label.