The Stiz Media, LLC

Making your website work for you

  • Styles for Genesis
    • FAQs
  • Cart
  • My Account
  • Home
  • Web Design
  • Portfolio
  • Resources
  • Blog
  • Contact

Powerful websites, with style.

Home » Blog » Create Posts 2 Posts ‘connections’ with the WordPress Rest API

Create Posts 2 Posts ‘connections’ with the WordPress Rest API

August 28, 2016 JiveDig

Restful P2P Example

I’ve written a lightweight plugin to make it extremely easy to create Posts 2 Posts connections via the WordPress WP-API (Rest API). If you don’t know about Posts 2 Posts, it’s an extremely powerful (developer) plugin that allows you to create a ‘connection’ between 2 objects, often posts, pages, or CPT, but also users.

A typical example Posts 2 Posts (P2P) usage is a website where you have 2 custom post types, actors and movies. They exist as separate post types so they can easily be managed via the WP backend, and each post type can conveniently have its own set of custom fields associated with it. P2P allows you to ‘connect’ (one-to-many or many-to-many) an actor to the movies they were in, or vice-a-versa (optional).

Lately I’ve been using P2P for more user based connections like allowing a logged in user to ‘like’ or ‘favorite’ posts, mark a CPT as ‘completed’, or save posts/CPT’s to ‘wish lists’. When I think about the use cases for allowing connections between logged in users and a CPT, the ideas start flowing.

Using the WordPress Rest API allows the power and flexibility of P2P connections with the ease of the WP-API for creating the connections (front end, ajax = no page reload, woot!).

Restful P2P example

The Restful P2P plugin comes with a simple helper function to help you create/display a connection button.

That’s it. Everything else is handled for you. Nice and tidy.

Now is your turn. Give the Restful P2P plugin a try.

What are some use cases you have for a plugin like Restful P2P and Posts 2 Posts?

Related Posts

  • CPT filter by taxonomy
    Custom Post Type Filter Admin By Custom Taxonomy
  • Remove Items from TinyMCE editor
    Remove Buttons/Items From The WordPress TinyMCE Editor
  • EA Share Count SMS button
    Add SMS share button to EA Share Count plugin

Tutorials Posts 2 Posts

‹ Add SMS share button to EA Share Count plugin

Try The Most Powerful Genesis Child Theme Ever Created

Mai Theme is the most customizable Genesis child theme (and plugin!) available. Check it out now!

Learn More @ MaiTheme.com

Our posts, directly to your inbox

Our posts, directly to your inbox


Howdy, I'm Mike Hemberger. I like to build nice websites and web apps with WordPress and Genesis Framework.

I'm passionate about everything I do, and it resonates in all of my work.

Feel free to email, and you'll be speaking directly with me.

Recent Posts

Restful P2P Example

Create Posts 2 Posts ‘connections’ with the WordPress Rest API

EA Share Count SMS button

Add SMS share button to EA Share Count plugin

ACF Extras

ACF Extras officially launched! A community of code snippets and field groups

Remove Items from TinyMCE editor

Remove Buttons/Items From The WordPress TinyMCE Editor

  • My Account
  • Affiliate Area
  • Log In|Log Out
  • GitHub
  • Instagram
  • Twitter
  • YouTube

Copyright © 2025 · The Stiz Media, LLC · All Rights Reserved