I've created a new settings page that has 2 tabs, then created a new custom fields group and linked it to the first tab on the settings page. The settings page was working properly until this point.
Then I generated the PHP code for both, the settings page and the custom fields and trashed them.
I put the generated code in a file and included it in the functions.php
file. I can see the settings page and its tabs, but no fields are showing on the settings tab.
Here's the generated code, please advise if there's anything wrong with my code, and how to resolve the issue:
<?php
add_filter( 'mb_settings_pages', 'register_settings__admins' );
function register_settings__admins( $settings_pages ) {
$settings_pages[] = [
'menu_title' => 'Admins Settings',
'option_name' => 'settings_admins',
'position' => 25,
'parent' => 'options-general.php',
'style' => 'no-boxes',
'columns' => 1,
'tabs' => [
'settings_admins__general_tab' => 'General',
'settings_admins__sticky_posts_tab' => 'Sticky Posts',
],
'tab_style' => 'left',
'icon_url' => 'dashicons-admin-generic',
];
return $settings_pages;
}
add_filter( 'rwmb_meta_boxes', 'settings_admins_general_fields' );
function settings_admins_general_fields( $meta_boxes ) {
$prefix = 'settings_';
$meta_boxes[] = [
'title' => 'settings_admins__general',
'id' => 'settings_admins__general',
'settings_pages' => ['settings_admins'],
'tab' => 'settings_admins__general_tab',
'fields' => [
[
'name' => 'Classic Editor',
'id' => $prefix . 'classic_editor_is_active',
'type' => 'checkbox',
'desc' => 'Use the classic editor instead of the block editor.',
],
[
'name' => 'Classic Widgets',
'id' => $prefix . 'classic_widgets_is_active',
'type' => 'checkbox',
'desc' => 'Use the classic view of widgets.',
],
],
];
return $meta_boxes;
}