# betterdocs/4.9.5/react-src/admin/switcher.js

BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ &amp; Chatbot, version 4.9.5. 26 lines.

- Page: https://pluginprobe.com/plugins/betterdocs/4.9.5/code/react-src/admin/switcher.js
- Raw: https://pluginprobe.com/plugins/betterdocs/4.9.5/raw/react-src/admin/switcher.js
- Modified: 2026-10-12T10:07:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/betterdocs/4.9.5/code/react-src/admin/switcher.js#L10-L20`.

```javascript
(function ($) {
    "use strict";
    $(document).ready(function () {
        var cfg = window.betterdocsSwitcher;
        if (!cfg || !cfg.page) {
            return;
        }
        // Inject the "Switch to BetterDocs UI" button next to the page heading.
        // The script is only enqueued on the relevant classic screens (Docs,
        // FAQ, FAQ groups, Product FAQ groups, Doc Categories, Doc Tags), so
        // targeting the first .wp-heading-inline is safe. `cfg.url` is the
        // full React admin page URL (it can carry extra args like the FAQ
        // Builder tab); `cfg.page` is the older slug-only fallback.
        var href = cfg.url || "admin.php?page=" + cfg.page;
        $(".wp-heading-inline")
            .first()
            .after(
                '<a href="' +
                    href +
                    '" class="page-title-action betterdocs-ui-switch">' +
                    (cfg.menu_title || "Switch to BetterDocs UI") +
                    "</a>"
            );
    });
})(jQuery);

```
