Title: Switcher
Author: Kostya Tereshchuk
Published: <strong>2017 年 11 月 24 日</strong>
Last modified: 2026 年 10 月 15 日

---

搜索插件

![](https://ps.w.org/switcher/assets/banner-772x250.png?rev=3747611)

![](https://ps.w.org/switcher/assets/icon-256x256.png?rev=3747611)

# Switcher

 作者：[Kostya Tereshchuk](https://profiles.wordpress.org/kostyatereshchuk/)

[下载](https://downloads.wordpress.org/plugin/switcher.1.3.0.zip)

 * [详情](https://cn.wordpress.org/plugins/switcher/#description)
 * [评价](https://cn.wordpress.org/plugins/switcher/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/switcher/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/switcher/#developers)

 [支持](https://wordpress.org/support/plugin/switcher/)

## 描述

Switcher adds one icon button to the WordPress toolbar. On an admin page it opens
the public page you viewed last; on a public page it opens the admin page you viewed
last. Before you have viewed anything it opens the home page or the dashboard.

 * No settings, no extra files to load, nothing stored on the server.
 * Two cookies in your browser remember the last page on each side for 30 days (`
   switcher_public_url`, `switcher_admin_url`); they are set with the Secure (on
   HTTPS), HttpOnly and SameSite=Lax attributes.
 * Only real page views count: not AJAX or REST calls, feeds, embeds, 404 pages,
   previews or form submissions.
 * The button only ever opens an address on this site.
 * Keyboard shortcut: Ctrl+Alt+S (also on a Mac) switches sides without touching
   the mouse; it is ignored while you type in a field. The tooltip shows where the
   button leads.
 * Works for every logged-in user who sees the toolbar; visitors get nothing.

Developers: `switcher_cookie_lifetime` filters the 30 days, `switcher_cookie_options`
the arguments passed to `setcookie()`, `switcher_shortcut` the key combination (
return an empty array to disable it).

## 屏幕截图

[[

[[

## 安装

 1. Install Switcher from “Plugins > Add New” (search for “switcher toolbar”) or upload
    the `switcher` folder to `/wp-content/plugins/`.
 2. Activate it. The button appears at the right end of the toolbar.

## 常见问题

### I hide the toolbar on the front end. Does the button still work?

The button lives in the toolbar, so it is visible only where the toolbar is. Your
public page views are still remembered, so the button on the admin side keeps working.

### Does it store anything in the database?

No. The two cookies live in your browser only.

### Can I change or disable the keyboard shortcut?

Yes, with the `switcher_shortcut` filter: return an array with `ctrl`, `alt`, `shift`,`
meta` flags and a `code` such as `KeyS`, or an empty array to disable it.

## 评价

![](https://secure.gravatar.com/avatar/2a75770482d6ebce1b809048e964bd7eb6aa2427a84172684ede4980f8d6658e?
s=60&d=retro&r=g)

### 󠀁[Simple and useful](https://wordpress.org/support/topic/simple-and-useful-189/)󠁿

 [zukorich](https://profiles.wordpress.org/zukorich/) 2017 年 12 月 15 日

Installed this plugin on my few sites and got a pleasure!

 [ 阅读所有1条评价 ](https://wordpress.org/support/plugin/switcher/reviews/)

## 贡献者及开发者

「Switcher」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Kostya Tereshchuk ](https://profiles.wordpress.org/kostyatereshchuk/)

[帮助将「Switcher」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/switcher)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/switcher/)，查看[SVN仓库](https://plugins.svn.wordpress.org/switcher/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/switcher/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/switcher/)。

## 更新日志

#### 1.3.0

 * Rewritten: the server remembers the page you view and computes the button’s target
   when the toolbar is rendered; the only script left is a few lines for the shortcut,
   inline on the toolbar’s own script.
 * The target is validated as an address on this site; a cookie can no longer point
   the button elsewhere.
 * Cookies are set with the Secure, HttpOnly and SameSite=Lax attributes and use
   the site’s own cookie path, so sites in sub-directories no longer share one cookie.
   The 2017 cookies are ignored and expire by themselves.
 * Only real page views are remembered: no AJAX or REST calls, feeds, embeds, 404
   pages, previews or form submissions.
 * Fixed: a script error on public pages for users who hide the toolbar.
 * The button has an accessible name and a tooltip that shows where it leads; strings
   are translatable.
 * New: keyboard shortcut Ctrl+Alt+S (filter `switcher_shortcut`).
 * Requires WordPress 5.0 and PHP 7.3; tested up to 7.1.

#### 1.2

 * Switch between the recently viewed admin page and the recently viewed public 
   page.

## 额外信息

 *  版本 **1.3.0**
 *  最后更新：**1 月前**
 *  活跃安装数量 **30+**
 *  WordPress 版本 ** 5.0 或更高版本 **
 *  已测试的最高版本为 **7.1.4**
 *  PHP 版本 ** 7.3 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/switcher/)
 * 标签
 * [admin](https://cn.wordpress.org/plugins/tags/admin/)[admin bar](https://cn.wordpress.org/plugins/tags/admin-bar/)
   [navigation](https://cn.wordpress.org/plugins/tags/navigation/)[switch](https://cn.wordpress.org/plugins/tags/switch/)
   [toolbar](https://cn.wordpress.org/plugins/tags/toolbar/)
 *  [高级视图](https://cn.wordpress.org/plugins/switcher/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/switcher/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/switcher/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/switcher/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/switcher/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/switcher/reviews/?filter=1)

[您的评价](https://wordpress.org/support/plugin/switcher/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/switcher/reviews/)

## 贡献者

 *   [ Kostya Tereshchuk ](https://profiles.wordpress.org/kostyatereshchuk/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/switcher/)