Title: Random Post on Refresh
Author: Micah Wood
Published: <strong>2018 年 3 月 30 日</strong>
Last modified: 2025 年 5 月 25 日

---

搜尋外掛

![](https://ps.w.org/random-post-on-refresh/assets/icon-256x256.png?rev=3300317)

# Random Post on Refresh

 由 [Micah Wood](https://profiles.wordpress.org/wpscholar/) 開發

[下載](https://downloads.wordpress.org/plugin/random-post-on-refresh.1.2.3.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/random-post-on-refresh/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/random-post-on-refresh/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/random-post-on-refresh/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/random-post-on-refresh/#developers)

 [技術支援](https://wordpress.org/support/plugin/random-post-on-refresh/)

## 外掛說明

**Random Post on Refresh** 外掛讓使用者在頁面載入時隨機顯示不同文章的內容。

外掛的使用方式非常簡單：

 1. 安裝外掛。
 2. 啟用外掛。
 3. 在頁面或文章要顯示隨機文章內容的地方，插入 `[random_post_on_refresh]` 短代碼，之後
    載入這個有短代碼的頁面便會顯示隨機文章內容。
 4. 儲存編輯內容。

#### 外掛特色

 * 可用於自訂內容類型。
 * 沒有外掛設定頁面，透過外掛提供的短代碼便能在網站上顯示隨機文章內容。
 * 乾淨、良好撰寫習慣且不會造成網站遲滯的程式碼。

## 安裝方式

#### 先決條件

如果網站主機不符合安裝必要條件，強烈建議升級網站的 WordPress 版本，或將網站遷移至
支援較新版本 PHP 的主機環境。

 * 需要 WordPress 6.4 或更新版本
 * 需要 PHP 7.4 或更新版本

#### 自動安裝

 1. 在 WordPress 管理後台中，前往 [外掛] 頁面，然後點擊 [安裝外掛]。
 2. 在搜尋框中，輸入 `Random Post on Refresh` 並按下 Enter 鍵，這個外掛應該會是第一
    筆或唯一的搜尋結果。
 3. 點擊 [安裝]。
 4. 安裝完畢後，點擊 [啟用]。

#### 手動安裝

 1. 下載外掛安裝套件的 ZIP 壓縮檔。
 2. 將解壓縮得到的 `random-post-on-refresh` 資料夾上傳至網站的 `/wp-content/plugins/`
    目錄。
 3. 在 [外掛] 頁面中找到這個外掛，然後點擊 [啟用]。

## 常見問題集

`[random_post_on_refresh]` 短代碼提供多個屬性，讓使用者能更細部控制隨機文章內容的
顯示結果：

 * **author**：如果只需要顯示一位或少數幾位作者的隨機文章，請使用作者 ID 或以逗號
   分隔多個作者 ID。範例：`[random_post_on_refresh author="1, 11, 14"]`
 * **ids**：如果只需要顯示指定文章為隨機文章，請使用文章 ID 或以逗號分隔多個文章
   ID。範例：`[random_post_on_refresh ids="19, 87, 113, 997"]`
 * **image_required**：這項屬性僅會在 `show` 屬性包含 `image` 時生效。這個屬性的
   預設值為 `true`，並會讓 WordPress 篩選掉沒有圖片的文章。如果這個屬性設定為 `false`，
   那無論文章是否有圖片都會加以顯示。範例：`[random_post_on_refresh show="title,
   image" image_required="false"]`
 * **not**：如果只需要顯示排除指定文章的隨機文章，請使用文章 ID 或以逗號分隔多個
   文章 ID。範例：`[random_post_on_refresh not="3, 456, 876"]`
 * **order**：參數值可為 asc (遞增) 或 desc (遞減)。預設值為 desc。
 * **orderby**：自訂 WordPress 對擷取結果的排序方式。請參閱 [https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters)。
 * **post_type**：如果只需要顯示指定內容類型的隨機文章，請使用指定內容類型的代稱。
   這個屬性的預設值為 `post`。範例：`[random_post_on_refresh post_type="page"]`
 * **posts_per_page**：擷取的內容結果每頁顯示數量，預設值為 100。會從擷取的內容中
   隨機選取以顯示。
 * **search**：將指定搜尋關鍵字傳回的文章顯示為隨機文章。範例：`[random_post_on_refresh
   search="relativity"]`
 * **taxonomy**：用於顯示指定分類法的隨機文章，必須搭配 `terms` 屬性使用。範例：`[
   random_post_on_refresh taxonomy="post_tag" terms="2,4"]`
 * **terms**：用於顯示指定分類法詞彙的隨機文章，請使用分類法詞彙 ID 或以逗號分隔
   多個分類法詞彙 ID，且必須搭配 `taxonomy` 屬性。使用範例：`[random_post_on_refresh
   taxonomy="post_tag" terms="2,4"]`
 * **class**：將 HTML `div` 標籤中包含指定的類別名稱的內容顯示為隨機文章。範例：`[
   random_post_on_refresh class="my-custom-class"]`
 * **size**：將包含指定註冊尺寸圖片的內容顯示為隨機文章。這是**選用**屬性，僅適用於
   包含圖片的內容。範例：`[random_post_on_refresh size="thumbnail"]`
 * **show**：僅顯示隨機文章的指定內容元素，請使用逗號或分隔號 `|` 分隔多個內容元素。
   有效的屬性值為 title、image、excerpt 及 content，預設值為 `title, image, excerpt`。
   範例：`[random_post_on_refresh show="title, image"]`

請銘記於心，以上短代碼屬性均可依需求合併使用。範例：`[random_post_on_refresh author
="19" size="full" not="2310"]`。此外，外掛提供的短代碼也可以使用於核心程式內建的[
文字] 小工具。

## 使用者評論

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

### 󠀁[Simple Perfection](https://wordpress.org/support/topic/simple-perfection-4/)󠁿

 [mrtoddkennedy](https://profiles.wordpress.org/mrtoddkennedy/) 2025 年 10 月 21
日

Exactly what I was looking for, works perfectly every time, easy to implement!

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

### 󠀁[Works perfectly!](https://wordpress.org/support/topic/works-perfectly-2475/)󠁿

 [Jericho](https://profiles.wordpress.org/jerichomontes/) 2022 年 6 月 13 日 1 則
留言

Thanks for this plugin! 🙂

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

### 󠀁[Perfect](https://wordpress.org/support/topic/perfect-8278/)󠁿

 [unruly333](https://profiles.wordpress.org/unruly333/) 2021 年 3 月 11 日 1 則留言

Feels light weight and does exactly what it says it does.

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

### 󠀁[super](https://wordpress.org/support/topic/super-2076/)󠁿

 [loupiloop](https://profiles.wordpress.org/loupiloop/) 2021 年 1 月 10 日

thanks for this plugin !

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

### 󠀁[Great plugin!](https://wordpress.org/support/topic/great-plugin-27884/)󠁿

 [jodirogers](https://profiles.wordpress.org/jodirogers/) 2020 年 9 月 17 日 1 則
留言

Works like a charm, does exactly what I wanted it to do! Thanks Micah!

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

### 󠀁[Works great](https://wordpress.org/support/topic/works-great-6815/)󠁿

 [jeffw203](https://profiles.wordpress.org/jeffw203/) 2020 年 5 月 29 日 1 則留言

Does exactly what it says it does. Be sure to suppress caching on the pages that
you use it.

 [ 閱讀全部 6 則使用者評論 ](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈Random Post on Refresh〉的開發相關工作。

參與者

 *   [ Micah Wood ](https://profiles.wordpress.org/wpscholar/)
 *   [ imzodigital ](https://profiles.wordpress.org/imzodigital/)

〈Random Post on Refresh〉外掛目前已有 1 個本地化語言版本。 感謝[全部譯者](https://translate.wordpress.org/projects/wp-plugins/random-post-on-refresh/contributors)
為這個外掛做出的貢獻。

[將〈Random Post on Refresh〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/random-post-on-refresh)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/random-post-on-refresh/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/random-post-on-refresh/)，或
透過 [RSS](https://plugins.trac.wordpress.org/log/random-post-on-refresh/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/random-post-on-refresh/)。

## 變更記錄

#### 1.2.3

 * Allow customization of order and orderby query args.

#### 1.2.2

 * General maintenance
 * Allow customization of posts_per_page query arg

#### 1.2.1

 * General maintenance
 * Allow filtering of query args

#### 1.2

 * Added a shortcode attribute to allow posts without images to be shown when the`
   show` attribute contains `image`.
 * Bug fix for certain strings not being translatable.

#### 1.1.1

 * Fixed bug where post excerpts were being generated incorrectly.

#### 1.1

 * Ensure code meets coding standards.
 * Don’t allow the current post to be selected as the random post.
 * Always return the last 100 matching items and select the random post from one
   of those.
 * Tested in WordPress 5.0

#### 1.0

 * Tested in WordPress version 4.9.2

## 中繼資料

 *  版本 **1.2.3**
 *  最後更新 **1 年前**
 *  啟用安裝數 **500+**
 *  WordPress 版本需求 ** 6.4 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.8.5**
 *  PHP 版本需求 ** 7.4 或更新版本 **
 *  語言
 * [Chinese (Taiwan)](https://tw.wordpress.org/plugins/random-post-on-refresh/) 
   及 [English (US)](https://wordpress.org/plugins/random-post-on-refresh/).
 *  [將這個外掛本地化為你的母語版本](https://translate.wordpress.org/projects/wp-plugins/random-post-on-refresh)
 * 標籤:
 * [different post](https://tw.wordpress.org/plugins/tags/different-post/)[post rotation](https://tw.wordpress.org/plugins/tags/post-rotation/)
   [random post](https://tw.wordpress.org/plugins/tags/random-post/)
 *  [進階檢視](https://tw.wordpress.org/plugins/random-post-on-refresh/advanced/)

## 評分

 5 星，滿分為 5 星

 *  [  6 個 5 星使用者評論     ](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/random-post-on-refresh/reviews/)

## 參與者

 *   [ Micah Wood ](https://profiles.wordpress.org/wpscholar/)
 *   [ imzodigital ](https://profiles.wordpress.org/imzodigital/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/random-post-on-refresh/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://www.paypal.me/wpscholar)