diff --git a/docs/SETTINGS-TAB-EXTENSIONS.md b/docs/SETTINGS-TAB-EXTENSIONS.md
index 5b46333f..4f103118 100644
--- a/docs/SETTINGS-TAB-EXTENSIONS.md
+++ b/docs/SETTINGS-TAB-EXTENSIONS.md
@@ -6,6 +6,8 @@ FrontBlocks exposes two hooks for companion plugins that need a dedicated tab on
Use the `frontblocks_settings_tabs` filter to append a tab definition. Each tab requires a unique `id` and a user-facing `label`.
+Add the filter before the `admin_menu` action runs: at the top level of your plugin file as in the example below, or on `plugins_loaded` or `init`. WordPress builds the admin menu before `admin_init`, so a tab added on `admin_init` or later gets no menu entry and no page of its own.
+
Use the `frontblocks_settings_tab_panels` action to output its panel. The panel must use the same ID in its `data-tab-panel` attribute and include the `frbl-tab-panel` class. Add the `hidden` attribute so the standard tab script controls its initial visibility.
```php
@@ -40,10 +42,12 @@ FrontBlocks has a menu of its own in the admin sidebar, right below Appearance,
| `blocks` (the first tab) | `frontblocks-settings` | `admin.php?page=frontblocks-settings` |
| any other, for example `my-plugin` | `frontblocks-settings-my-plugin` | `admin.php?page=frontblocks-settings-my-plugin` |
-- Your tab appears in the submenu automatically. Add `'menu' => false` to the tab definition to keep it out of the submenu. It is still a tab of the screen.
+- Your tab appears in the submenu automatically. Add `'menu' => false` to the tab definition to keep it out of the submenu. It is still a tab of the screen: it has no page of its own, so clicking it keeps the current page and adds its `#tab` to the URL.
+- The first entry, `admin.php?page=frontblocks-settings`, is always in the submenu, even if a filter removes the `blocks` tab or hides it.
- Link to a tab with `\FrontBlocks\Admin\Settings::get_settings_url( 'my-plugin' )`, not with a hard-coded URL.
- Recognize the settings screens with `\FrontBlocks\Admin\Settings::is_settings_screen( $hook_or_screen_id )`. The screen ID of a tab is not the same on every tab, and it was different when the screen lived under Appearance. Do not compare it with a fixed string such as `appearance_page_frontblocks-settings`.
- Check that the method exists before you call it if your plugin must work with older versions of FrontBlocks, which had the page under Appearance (`themes.php?page=frontblocks-settings`).
- The old Appearance URL still works. It redirects to the new menu and keeps its query arguments and its `#tab`.
+- A post type of your plugin can live in the same menu: register it with `'show_in_menu' => \FrontBlocks\Admin\Settings::PAGE_SLUG`. Its entry goes after the settings tabs. WordPress does not add the taxonomy entries of a post type shown in another menu, so add them with `add_submenu_page()` (FrontBlocks does this for the event categories). With older versions of FrontBlocks, keep `'show_in_menu' => true`.
The panel action runs after FrontBlocks closes its settings form. If your tab submits data, provide its own form, nonce, capability checks, and sanitization.
diff --git a/docs/STAGING.md b/docs/STAGING.md
index 2d41c8a8..a5997090 100644
--- a/docs/STAGING.md
+++ b/docs/STAGING.md
@@ -4,7 +4,7 @@ Staging Mode applies a set of safety measures when a site is a staging or copy e
Everything is applied at runtime through filters. FrontBlocks never changes a stored option (`blog_public`, gateway settings...), so the behaviour is reversible and is not carried over by a database copy.
-The implementation is `FrontBlocks\Frontend\Staging` (`includes/Frontend/Staging.php`). Its settings live in the **Maintenance** tab of the FrontBlocks settings (Appearance → FrontBlocks), in the **Staging Mode** section below Maintenance Mode. That section also shows why staging mode is active.
+The implementation is `FrontBlocks\Frontend\Staging` (`includes/Frontend/Staging.php`). Its settings live in the **Maintenance** tab of the FrontBlocks settings (FrontBlocks → Maintenance in the admin menu), in the **Staging Mode** section below Maintenance Mode. That section also shows why staging mode is active.
## When it is active
diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php
index 8c1cd46d..05ee4518 100644
--- a/includes/Admin/Settings.php
+++ b/includes/Admin/Settings.php
@@ -286,7 +286,11 @@ public function __construct() {
// Check license via FrontBlocks PRO helper function.
$this->is_license_valid = function_exists( 'frblp_is_license_valid' ) && frblp_is_license_valid();
- add_action( 'admin_menu', array( $this, 'register_menu' ) );
+ // Before WordPress adds the entries of the post types shown in this menu (priority 10),
+ // so the settings come first and the menu opens them.
+ add_action( 'admin_menu', array( $this, 'register_menu' ), 9 );
+ // After every other entry, so License closes the menu.
+ add_action( 'admin_menu', array( $this, 'move_license_entry_last' ), 98 );
add_action( 'admin_menu', array( $this, 'redirect_legacy_url' ), 99 );
add_action( 'admin_init', array( $this, 'register_settings' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
@@ -361,7 +365,8 @@ function updateMutualExclusion() {
} else {
moveContentCheckbox.disabled = !isLicenseValid;
if (moveContentWrapper) {
- moveContentWrapper.style.opacity = isLicenseValid ? '1' : '0.5';
+ // Leave the locked PRO look to the .frbl-feature-pro styles.
+ moveContentWrapper.style.opacity = '';
moveContentWrapper.style.filter = '';
const toggle = moveContentWrapper.querySelector('.frbl-toggle');
if (toggle) {
@@ -385,7 +390,8 @@ function updateMutualExclusion() {
} else {
deactivateCheckbox.disabled = !isLicenseValid;
if (deactivateWrapper) {
- deactivateWrapper.style.opacity = isLicenseValid ? '1' : '0.5';
+ // Leave the locked PRO look to the .frbl-feature-pro styles.
+ deactivateWrapper.style.opacity = '';
deactivateWrapper.style.filter = '';
const toggle = deactivateWrapper.querySelector('.frbl-toggle');
if (toggle) {
@@ -711,17 +717,22 @@ function syncMenu(tabId) {
}
// Point the address bar at the page of the tab, so a reload or a copied link opens it.
+ // A tab without a page of its own keeps the current page and is opened by its #hash.
function updateUrl(tabId) {
var page = tabPages[tabId];
- if (! page || ! window.history || ! window.history.replaceState) {
+ if (! tabId || ! window.history || ! window.history.replaceState) {
return;
}
var url = new URL(window.location.href);
- url.search = '';
- url.hash = '';
- url.searchParams.set('page', page);
+ if (page) {
+ url.search = '';
+ url.hash = '';
+ url.searchParams.set('page', page);
+ } else {
+ url.hash = tabId;
+ }
window.history.replaceState(null, '', url.toString());
}
@@ -807,7 +818,20 @@ function activateTab(tabId) {
var active = document.querySelector('.frbl-tab-btn.is-active');
var tabId = active ? active.getAttribute('data-tab-target') : initialTab;
var url = referer.value.split('#')[0];
- referer.value = url + '#' + tabId;
+ var page = tabPages[tabId];
+
+ // Return to the page of the active tab, so the URL and the tab match.
+ if (page) {
+ try {
+ var parsed = new URL(url, window.location.href);
+ parsed.searchParams.set('page', page);
+ url = parsed.pathname + parsed.search;
+ } catch (error) {
+ page = '';
+ }
+ }
+
+ referer.value = page ? url : url + '#' + tabId;
});
}
@@ -965,7 +989,63 @@ public static function get_settings_url( $tab = '' ) {
* @return bool
*/
public static function is_settings_screen( $screen_id ) {
- return is_string( $screen_id ) && false !== strpos( $screen_id, self::PAGE_SLUG );
+ if ( ! is_string( $screen_id ) ) {
+ return false;
+ }
+
+ // The page slug, or the page slug and a tab id, alone or after the "