Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('mb_relationships_init', function () {
- $post_id = null;
- if ( isset( $_GET['post'] ) ) {
- $post_id = intval( $_GET['post'] );
- } elseif ( isset( $_POST['post_ID'] ) ) {
- $post_id = intval( $_POST['post_ID'] );
- }
- global $wpdb;
- $filteredIds = $wpdb->get_col( $wpdb->prepare( 'SELECT `from` FROM wp_mb_relationships WHERE wp_mb_relationships.to = %s', $post_id ) );
- MB_Relationships_API::register(array(
- 'id' => 'p2p',
- 'from' => array(
- 'type' => 'post',
- 'post_type' => 'post',
- 'admin_column' => true,
- 'meta_box' => [
- 'title' => 'Pages'
- ],
- 'query_args' => [ 'post__in' => $filteredIds ],
- ),
- 'to' => array(
- 'type' => 'post',
- 'post_type' => 'page',
- 'meta_box' => [
- 'title' => 'Posts'
- ],
- ),
- ) );
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement