Advertisement
swest

relationship-event-to-topic

Feb 14th, 2025
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2. add_action( 'mb_relationships_init', 'your_prefix_function_name' );
  3.  
  4. function your_prefix_function_name() {
  5.     MB_Relationships_API::register( [
  6.         'id'          => 'event-to-topic',
  7.         'delete_data' => false,
  8.         'reciprocal'  => false,
  9.         'from'        => [
  10.             'object_type'  => 'post',
  11.             'post_type'    => 'event',
  12.             'admin_filter' => false,
  13.             'admin_column' => [
  14.                 'position' => 'after title',
  15.                 'title'    => 'Related Topic(s)',
  16.                 'link'     => 'view',
  17.             ],
  18.             'meta_box'     => [
  19.                 'title'  => 'Related Topic(s)',
  20.                 'closed' => false,
  21.             ],
  22.             'field'        => [
  23.                 'name'    => 'Event',
  24.                 'add_new' => false,
  25.             ],
  26.         ],
  27.         'to'          => [
  28.             'object_type'  => 'post',
  29.             'post_type'    => 'topic',
  30.             'admin_filter' => false,
  31.             'admin_column' => [
  32.                 'position' => 'after title',
  33.                 'title'    => 'Event',
  34.                 'link'     => 'view',
  35.             ],
  36.             'meta_box'     => [
  37.                 'title'    => 'Related Event',
  38.                 'context'  => 'normal',
  39.                 'priority' => 'high',
  40.                 'closed'   => false,
  41.             ],
  42.             'field'        => [
  43.                 'name'    => 'Topic',
  44.                 'add_new' => false,
  45.             ],
  46.         ],
  47.     ] );
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement