Title: Primary Cat
Author: Web Guy
Published: <strong>2021 年 1 月 5 日</strong>
Last modified: 2026 年 5 月 22 日

---

搜尋外掛

![](https://ps.w.org/primary-cat/assets/banner-772x250.jpg?rev=2450877)

![](https://ps.w.org/primary-cat/assets/icon-256x256.jpg?rev=2450877)

# Primary Cat

 由 [Web Guy](https://profiles.wordpress.org/webguyio/) 開發

[下載](https://downloads.wordpress.org/plugin/primary-cat.zip)

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

 [技術支援](https://wordpress.org/support/plugin/primary-cat/)

## 外掛說明

[💬 Ask Question](https://github.com/webguyio/support) | [📧 Email Me](https://tw.wordpress.org/plugins/primary-cat/webguywork@gmail.com?output_format=md)

Set a primary category for your posts… and then do stuff with it.

**Why would I want a primary category?**

Out of the box, WordPress allows you to assign multiple categories to a post. Unless
you’re enforcing a strict one-category-per-post-only rule for your website, this
can be a problem now for displaying the most important category for your respective
posts, as opposed to WordPress automatically selecting it for you.

Let’s say that your blog is about animals, and you publish an article titled “Why
Do Dogs Love Water and Cats Hate It?” with the categories: _Cats_, _Dogs_, and _Pets_
assigned to it.

By default, anywhere that WordPress might display a single category to represent
the post, it’s probably going to display _Cats_ by default, but since the post is
equally about both cats and dogs, maybe the more general _Pets_ category would be
more appropriate.

This plugin allows you to accomplish that, whether it’s for presentational, structural,
organizational, SEO, or all of the above purposes.

**In what ways can I utilize a primary category?**

    ```
    [primary-cat]
    ```

In any creative way that you can imagine, but here are some examples I thought of:

 * To present the main category that the post belongs to above its title (by adding`
   <?php echo do_shortcode( '[primary-cat]' ); ?>` in your theme code, child theme,
   or custom functions plugin), in some aesthetic way (which can be styled with 
   CSS `.primary-cat`). Lots of blog, news, and magazine sites have this feature.
 * To have the appropriate slug in your post URLs if you’re using the custom `/%
   category%/%postname%/` permalink structure under _Settings > Permalinks_.
 * To have breadcrumbs (by using the shortcode `[primary-bread]`) on your site for
   user-friendliness (which can be styled with CSS `#breadcrumbs`), and can in turn,
   also improve SEO.

## 安裝方式

 * Install and activate the plugin
 * Create or edit a post
 * You’ll now be able to set a category as the primary category or add your own 
   custom text
 * Use the `[primary-cat]` shortcode on any page, post, or text widget or in your
   theme code, with `<?php echo do_shortcode( '[primary-cat]' ); ?>`

## 常見問題集

### It’s not working?

 * You can enter whatever text you like into the Primary Category field to represent
   your post, and it’s not even required to actually be a registered category. However,
   for certain features to work right, like overriding the category slug in URLs,
   it needs to also be an actual category.
 * You may need to flush the permalinks by going to _Settings > Permalinks_ and 
   clicking on “Save Changes.”
 * You may need to clear any caches and refresh your browser.

## 使用者評論

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

## 參與者及開發者

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

參與者

 *   [ Web Guy ](https://profiles.wordpress.org/webguyio/)

[將〈Primary Cat〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/primary-cat)

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

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

## 變更記錄

#### 0.3

 * Added block support
 * Modernized the code

#### 0.2

 * Minor code cleanup

#### 0.1

 * New

## 中繼資料

 *  版本 **0.3**
 *  最後更新 **1 個月前**
 *  啟用安裝數 **少於 10 次**
 *  WordPress 版本需求 ** 5.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **7.0**
 *  語言
 * [English (US)](https://wordpress.org/plugins/primary-cat/)
 * 標籤:
 * [breadcrumbs](https://tw.wordpress.org/plugins/tags/breadcrumbs/)[categories](https://tw.wordpress.org/plugins/tags/categories/)
   [primary category](https://tw.wordpress.org/plugins/tags/primary-category/)[schema](https://tw.wordpress.org/plugins/tags/schema/)
   [seo](https://tw.wordpress.org/plugins/tags/seo/)
 *  [進階檢視](https://tw.wordpress.org/plugins/primary-cat/advanced/)

## 評分

這個項目尚無任何評論記錄。

[Your review](https://wordpress.org/support/plugin/primary-cat/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/primary-cat/reviews/)

## 參與者

 *   [ Web Guy ](https://profiles.wordpress.org/webguyio/)

## 技術支援

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

 [檢視技術支援論壇](https://wordpress.org/support/plugin/primary-cat/)

## 贊助

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

 [ 贊助這個外掛 ](https://webguy.io/donate)