PHPackages                             voceconnect/objects-to-objects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. voceconnect/objects-to-objects

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

voceconnect/objects-to-objects
==============================

A WordPress plugin/module that provides the ability to map relationships between posts and other post types

1.4.5(10y ago)347.1k7[2 issues](https://github.com/voceconnect/objects-to-objects/issues)GPLv2+PHP

Since Oct 29Pushed 7y ago16 watchersCompare

[ Source](https://github.com/voceconnect/objects-to-objects)[ Packagist](https://packagist.org/packages/voceconnect/objects-to-objects)[ RSS](/packages/voceconnect-objects-to-objects/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (28)Used By (0)

Objects to Objects [![Build Status](https://camo.githubusercontent.com/bac34fee32ad10ccdc913550958bb575677f7e20c86dcd7fc295f33680b145a9/68747470733a2f2f7472617669732d63692e6f72672f766f6365636f6e6e6563742f6f626a656374732d746f2d6f626a656374732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/voceconnect/objects-to-objects)
============================================================================================================================================================================================================================================================================================================================================

[](#objects-to-objects-)

Contributors: prettyboymp, klangley, csloisel, markparolisi, jeffstieler
Tags: relationships, mapping, connections, many-to-many
Requires at least: 3.6
Tested up to: 4.4
Stable tag: 1.4.5
License: GPLv2 or later
License URI:

A WordPress plugin/module that provides the ability to map relationships between posts and other post types.

Description
-----------

[](#description)

This plugin provides a development layer on top of WordPress' taxonomy system that simplifies the ability to create many-to-many relationships between post types.

Installation
------------

[](#installation)

### As standard plugin:

[](#as-standard-plugin)

> See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins).

### As theme or plugin dependency:

[](#as-theme-or-plugin-dependency)

> After dropping the plugin into the containing theme or plugin, add the following:

```
if( ! class_exists( 'O2O' ) ) {
	require_once( $path_to_o2o . '/objects-to-objects.php' );
}
```

Usage
-----

[](#usage)

### Registering a connection

[](#registering-a-connection)

Relationships are registered directly through the `O2O::Register_Connection()` method.

#### Parameters

[](#parameters)

- `$name` (string) - A string used as the lookup key when referencing the connection at later points.
- `$from_object_types` (array, string) - An array of object or post types that act as the parent for the connections. Note that because O2O uses WP's taxonomy system as it's data interface, care should be taken in deciding which object types are the from object vs the to object since options like sorting can't be applied to both directions of the connection.
- `$to_object_types` (array, string) - An array of object or post types that the from types can be connected to.
- `$args` (array) - An array of options for the connection
    - `reciprocal` (boolean) - Default: false. By default, the ability to make connections is only displayed on the edit screen for the `$from_object_types`.
    - `rewrite` (mixed) - Options: `false`, `'from'`, `'to'`. Default: false. When set to `'to'`, rewrite rules will automatically be added to supply an endpoint that lists the attached to objects of a single post object. When set to ```'from'`` the rewrite rule will be added that lists the attahed from objects.
    - `to` - (array) - An array of options specifically applied to the interface of connecting `to` objects.
        - `sortable` (boolean) - Default: false. When true, the user can set an order to the connected objects.
        - `limit` (integer) - Default: null. When set, the interface that allows users to add connected items stops allowing new connections to that object once the limit is reached.
        - `labels` (array) - The labels to use with the connection interface.
            - `name` (string) - The plural label to use when describing the connected objects.
            - `singular_name` (string) - The singular label to use when describing the connected objects.
    - `from` - (array) - An array of options specifically applied to the interface of connecting `from` objects.
        - `limit` (integer) - Default: null. When set, the interface that allows users to add connected items stops allowing new connections to that object once the limit is reached.
        - `labels` (array) - The labels to use with the connection interface.
            - `name` (string) - The plural label to use when describing the connected objects.
            - `singular_name` (string) - The singular label to use when describing the connected objects.
    - `metabox` - (array) - An array of options specifically applied to the metabox user interface
        - `orderby` (string) - Default: post\_date. Field to order the posts by within the metabox.
        - `order` (string) - Default: DESC. Order, ASC or DESC, to display the posts within the metabox.
        - `context` (string) - Default: side. Context to display the metabox on the post edit screen. Options are side, normal, and advanced.

#### Example

[](#example)

```
add_action('init', 'register_o2o_connection');
/**
 * Registers a many to many connection between posts and galleries that allows
 * related galleries to be assigned to a single post for listing.
 */
function register_o2o_connection() {
	O2O::Register_Connection('post_galleries', 'post', 'gallery', array(
		'reciprocal' => true,
		'to' => array(
			'sortable' => true,
			'labels' => array(
				'name' => 'Galleries',
				'singular_name' => 'Gallery'
			)
		),
		'from' => array(
			'labels' => array(
				'name' => 'Posts',
				'singular_name' => 'Post'
			)
		)
	));
}
```

### Querying a connection

[](#querying-a-connection)

O2O provides a custom WP\_Query query\_var that will filter the query based on the given connection details.

- `o2o_query` (array) - An array defining how a connection should be queried agaist.
    - `connection` (string) - The key/name of the connection being queried against.
    - `direction` (string) - Options 'to', 'from'. Default: 'to'. The side of the connection being queried. When set to 'to', only `$to_object_types` will be returned.
    - `id` (integer) - The ID of the post object from which the relationships will be queried.
    - `post_name` (string) - The post\_name of the post object from which the relationships will be queried. Will only be used if `id` is not set.
- `o2o_orderby` (string) - Set to the connection name to order the results by that connection's ordering. Note that the connection must have ordering set to true for the given direction.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~64 days

Total

26

Last Release

3694d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/68431036eb11480c4075c2363add4d23e8e7b7b28f43396165c5c63cbcbee049?d=identicon)[prettyboymp](/maintainers/prettyboymp)

![](https://www.gravatar.com/avatar/60c26d865c2615b90378cd9d45d70e3d11f58de984e6831a125ec22672c1d390?d=identicon)[voceconnect](/maintainers/voceconnect)

---

Top Contributors

[![jeffstieler](https://avatars.githubusercontent.com/u/63922?v=4)](https://github.com/jeffstieler "jeffstieler (5 commits)")[![kevinlangleyjr](https://avatars.githubusercontent.com/u/877634?v=4)](https://github.com/kevinlangleyjr "kevinlangleyjr (1 commits)")

---

Tags

wordpressRelationships

### Embed Badge

![Health badge](/badges/voceconnect-objects-to-objects/health.svg)

```
[![Health](https://phpackages.com/badges/voceconnect-objects-to-objects/health.svg)](https://phpackages.com/packages/voceconnect-objects-to-objects)
```

###  Alternatives

[tgmpa/tgm-plugin-activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins).

1.8k222.5k13](/packages/tgmpa-tgm-plugin-activation)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[justintadlock/hybrid-carbon

God-like post featured image script.

202.5k](/packages/justintadlock-hybrid-carbon)[typisttech/wp-admin-notices

A simplified OOP implementation of the WordPress admin notices

141.2k](/packages/typisttech-wp-admin-notices)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
