前言介紹
- 這款 WordPress 外掛「MB Relationships」是 2018-01-31 上架。
- 目前有 1000 個安裝啟用數。
- 上一次更新是 2025-02-14,距離現在已有 79 天。
- 外掛最低要求 WordPress 5.9 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.2 以上。
- 有 5 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
hsimah | rilwis | metabox | truongwp | anhdoanmis |
外掛標籤
connections | relationships | posts to posts |
內容簡介
MB Relationships 可協助您在文章、頁面或任何自訂文章類型之間建立多對多的關聯。插件輕量且優化了數據庫和查詢性能。
插件允許您從文章到文章、文章到頁面等建立關聯,然後您可以執行對應的查詢,以檢索與給定文章相關聯的文章或相對應的文章。
它支持相互和雙向關係。
為什麼您需要WordPress中的文章關係?
文章關係是WordPress中缺少的一部分。 WordPress中唯一“內置”模仿文章關係的方式是對於頁面的post_parent,您可以在頁面下創建多個子頁面(一對多的關係)。 不幸的是,這僅適用於頁面和階層式文章類型。 此外,它不是多對多關係。
以下是一些文章關係的示例,這可能有助於您了解此功能的好處:
在WordPress中創建相關文章
最簡單的示例是在您的WordPress網站上手動創建相關文章。 當您編輯一篇文章時,您可以選擇具有相似或相關內容的文章,並在前端顯示它們供進一步閱讀。
您還可以反向查詢:顯示鏈接到正在閱讀的文章的文章,作為提供更多信息給您的讀者的參考。 有了這個功能,您就不需要WordPress相關文章插件。
示例:活動和樂隊
假設您有兩個自定義文章類型,活動和樂隊,其中:
- 每個活動中可能會有多個樂隊,以及
- 每個樂隊可以參加許多活動。
如果人們想要購買門票,他們可以搜索他們所在地區的活動,並查看在特定日期播放的樂隊,或者他們可以搜索他們喜歡的樂隊,並查看他們在他們附近的日期播放。
在這個例子中,我們已經創建了活動和樂隊之間的多對多關係。
雙向關係
MB Relationships 允許您創建雙向連接。 您將能夠自由查詢前後。
數據以(from_id, to_id)的形式存儲在數據庫中,因此與任一方向獨立。
此外,對於每個方向,都有一個顯示從/到連接的元框。因此,您無需再擔心連接的方向。
Posts 2 Posts 插件 (P2P Plugin)的替代方案
MB Relationships 受到熱門插件Posts 2 Posts的啟發,後者已經不再維護。 我們採用了這個想法並進行了一些改進。 代碼庫和數據結構非常相似。
插件功能
- 簡單的API:插件提供簡單的API用於註冊關係並檢索連接的項目。 它與現有的WordPress API(例如 WP_Query , get_terms 和 get_users )集成。 欲了解更多信息,請參閱文檔。
- 使用自定義關係表存儲關係。 這有助於優化數據庫存儲和查詢性能。
- 您可以在WordPress中創建任何類型的內容之間的關係:文章對文章,文章對用戶等。 對於文章與术语和文章與使用者,需要MB Term Meta和MB User Meta。
- 支持創建互惠關係(文章-文章,使用者-文章等)
原文外掛簡介
MB Relationships helps you create relationships between posts, pages, custom post type, terms and users. The plugin is lightweight and optimized for database and query performance.
The plugin allows you to create connections from posts to posts, posts to pages and so on. Then you can perform corresponding queries to retrieve posts that are connected to or from given posts.
Meta Box Lite
We recommend using Meta Box Lite, a feature-rich free UI version of Meta Box that provides UI and all free features for managing custom fields and dynamic content on WordPress, including post types, taxonomies, custom fields, and relationships.
It supports reciprocal and bi-directional relationships.
Why Do You Need Posts To Posts Relationships In WordPress?
Post relationships is a missing part in WordPress. The only “built-in” way that mimic the post relationship in WordPress is the post_parent for pages where you can create many child pages of a page (a one-to-many relationship). Unfortunately, that’s available for pages and hierarchical post types only. Besides, it’s not many-to-many relationship.
Below are some examples of posts to posts relationships that might help you see the benefit of this feature:
Creating Related Posts In WordPress
The simplest example is to manually create related posts in your WordPress website. When you edit a post, you can select posts that have similar or related content and display them in the frontend for further reading.
You can also query backward: displaying posts that link to the being read post as a reference to provide more information to your readers. With this, you don’t need a WordPress related posts plugin anymore.
Example: Events And Bands
Suppose you have two custom post types, event and band, where:
In each event there may be multiple bands, and
Each band can participate in many events.
If people want to buy tickets, they could search for events in their location and see what bands are playing on a given date, or they could search for bands they like and see what date they are playing near their location.
In this example, we have created many-to-many relationships between events and bands.
Bi-directional relationships
MB Relationships allows you to create bi-directional connections. You will be able to query back and forth without any problem.
The data is stored in the database as a pair of (from_id, to_id), thus making it independent from either side.
Besides, for each side, there’s a meta box that shows what are connected from/to. So you don’t have to worry about the direction of the connection anymore.
An Alternative For The Posts 2 Posts Plugin (P2P Plugin)
MB Relationships is very much inspired by the popular plugin Posts 2 Posts which is not maintained anymore. We have taken the idea and made some improvements. The codebase and data structure is very similar.
Plugin features
Simple APIs: the plugin provides simple APIs for registering relationships and retrieving connected items. It integrates with existing WordPress APIs such as WP_Query,get_terms and get_users. See documentation for more information.
Uses custom relationship table to store relationships. That helps optimize the database storage and query performance.
You can create relationships between any kind of content in WordPress: posts to posts, posts to users, etc. For posts to terms and posts to users, it’s required the MB Term Meta and MB User Meta.
Supports creating reciprocal relationships (posts-posts, users-users, …).
Supports creating bi-directional relationships and easily query them.
Display connected items easily with shortcode.
Extremely lightweight and fast.
Plugin Links
Project Page
Github Repo
This plugin is a free extension of Meta Box plugin, which is a powerful, professional solution to create custom fields and custom meta boxes for WordPress websites. Using MB Relationships in combination with other extensions will help you manage any content types in WordPress easily and make your website more professional.
You might also like
If you like this plugin, you might also like our other WordPress products:
Meta Box – A powerful WordPress plugin for creating custom post types and custom fields.
Slim SEO – A fast, lightweight and full-featured SEO plugin for WordPress with minimal configuration.
Slim SEO Schema – An advanced, powerful and flexible plugin to add schemas to WordPress.
Slim SEO Link Manager – Build internal link easier in WordPress with real-time reports.
GretaThemes – Free and premium WordPress themes that clean, simple and just work.
Auto Listings – A car sale and dealership plugin for WordPress.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「MB Relationships」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.1.0 | 1.1.1 | 1.1.2 | 1.2.0 | 1.3.0 | 1.3.2 | 1.4.0 | 1.4.1 | 1.5.0 | 1.6.0 | 1.6.1 | 1.7.1 | 1.8.0 | 1.9.0 | 1.9.1 | 1.9.2 | trunk | 1.10.0 | 1.10.1 | 1.10.2 | 1.10.3 | 1.10.4 | 1.10.5 | 1.10.6 | 1.10.7 | 1.10.8 | 1.10.9 | 1.11.0 | 1.11.1 | 1.11.2 | 1.11.3 | 1.12.0 | 1.12.1 | 1.12.2 | 1.12.3 | 1.12.4 | 1.12.5 | 1.12.6 | 1.10.10 | 1.10.11 |
延伸相關外掛(你可能也想知道)
Posts 2 Posts 》此外掛允許您在任何類型的文章、頁面或自訂文章之間建立多對多的關係。以下是一些使用範例:, , 手動編輯有關聯的文章清單, 文章系列, 產品與零售商之間的關...。
BuddyPress Follow 》這個方便的外掛可讓您在 BuddyPress 網站上追蹤成員。, 這個外掛與好友組件的運作方式類似,但被追蹤的人不需要接受連結。就像 Twitter 一樣!, 此外掛新增了...。
WP What Links Here 》WP What Links Here 是一個 WordPress 外掛,實現了「連向此頁面的連結」功能,就像維基百科上那樣。每當頁面或文章被發佈或編輯時,它會被添加到後台佇列中...。
Connections to Directorist Migrator 》從一個目錄外掛程式轉移至另一個可能是一個繁瑣的任務。Directorist 提供了一個使用者友好的工具,可簡化移轉過程,讓您能夠將數千個 Connections 目錄清單數...。
Connections čeština 》翻譯 WordPress 外掛 Connections 的說明。。