Skip to content

Instantly share code, notes, and snippets.

@jonschr
Created October 30, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschr/62768067928ced1d501d14fe7e7b138c to your computer and use it in GitHub Desktop.
Save jonschr/62768067928ced1d501d14fe7e7b138c to your computer and use it in GitHub Desktop.
<?php
add_action( 'mb_relationships_init', function () {
MB_Relationships_API::register( array(
'id' => 'programs_to_updates',
'to' => 'projects',
'from' => 'updates',
) );
MB_Relationships_API::register( array(
'id' => 'users_to_posts',
'to' => array(
'object_type' => 'user',
'meta_box' => array(
'title' => 'Program access',
'field_title' => 'Select projects',
),
'field' => [
'query_args' => [
'number' => -1 // This
]
]
),
'from' => array(
'object_type' => 'post',
'post_type' => 'projects',
'meta_box' => array(
'title' => 'Clients with access',
'context' => 'side',
'empty_message' => 'No users',
),
),
) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment