| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
WordPress plugin that creates GraphQL connections for all of your Posts 2 Posts connections.
Let's say you have registered a Posts 2 Posts connection between the project custom post type on your site and the user object, like this:
function register_p2p_connection() {
p2p_register_connection_type( [
'name' => 'projects_to_managers',
'from' => 'project',
'to' => 'user'
] );
}
add_action( 'p2p_init', 'register_p2p_connection' );With this plugin activated, you can query for the users connected to projects, like this:
query getProjects {
projects(first: 10) {
nodes {
databaseId
title
projectsToManagersConnection {
nodes {
databaseId
name
}
}
}
}
}You can also query from the other direction, and get the projects connected to users, like this:
query getUsers {
users(first: 10) {
nodes {
databaseId
name
projectsToManagersConnection {
nodes {
databaseId
title
}
}
}
}
}I think the input fields for #3 will end up looking something like this:
projectsToManagersConnections: {
append: false
databaseIds: [1,4,8]
}| Back | FazBrowse Home | New Git URL |