這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

WP isAdmin

外掛說明

This plugin provides provides a simple short code to add or hide custom content to your posts and pages based on whether a user is an administrator (or other role) or not.

This started as a way around having an automatic redirect if somebody belonged to a specific WishListMember membership level but not wanting to redirect off of the page
if I was an admin (who always has access to all membership levels.)

螢幕擷圖

  • A simple example for how to use the shortcodes.
  • An example that includes a javascript redirect for WishListMember private tags, which still allows the admin user to stay on the page.

常見問題集

What shortcodes are available?

[isAdmin][/isAdmin] and [isNotAdmin][/isNotAdmin] are both supported, and will only show or hide the content (respectively) if the user is logged in and has an administrator
role (by default).

Can I specify other roles than just the administrator role?

Yes, you can set the role or roles attribute. So if you’d like content that can only be seen by users with the “editor” role, you would use: [isAdmin roles=”editor”][/isAdmin].

Can I specify more than one role?

Yes, just provide a comma-separated list to the roles attribute. For example: [isAdmin roles=”editor,administrator”][/isAdmin]

What is the difference between the *role* and *roles* attributes?

There is no difference; both are available as a convenience as I expected that if I wanted to change it I wouldn’t remember if I needed it to be plural or not and it would seem
odd to specify a plural attribute for a singular condition (and vice versa.) Basically, choose one or the other (if you want something other than checking for administrator) and
it will work as expected. If you specify both, then the roles attribute takes precedence unless you set it to the default, in which case it will use the role attribute.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈WP isAdmin〉的開發相關工作。

參與者

將〈WP isAdmin〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

= 1.0.1 (2020-09-17)=
* Initial Version