WP Связь type:post с custom type post

Есть такая задача - имеются футбольные команды с типом записи post, также в function.php была создана новая таксономия для игроков этих команд.


////// Football players

add_action( 'init', 'register_post_type_football_players' ); 

function register_post_type_football_players() {
    $labels = array(
        'name' => 'Football players',
        'singular_name' => 'Football player',
        'add_new' => 'Add football player',
        'add_new_item' => 'Add new football player', // заголовок тега <title>
        'edit_item' => 'Redact football player',
        'new_item' => 'New football player',
        'all_items' => 'All football players',
        'view_item' => 'Watch football player on a site',
        'search_items' => 'Search football player',
        'not_found' =>  'Football player did not find',
        'not_found_in_trash' => 'No players in trash',
        'menu_name' => 'Football players' // ссылка в меню в админке
    );
    $args = array(
        'label' => __( 'football-player', 'test' ),
        'description' => __( 'All football players', 'test' ),
        'labels' => $labels,
        'public' => true,
        'show_ui' => true, // показывать интерфейс в админке
        'has_archive' => true,
        'menu_icon' => 'dashicons-groups', // иконка в меню
        'menu_position' => 2, // порядок в меню
        'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions', 'custom-fields',),
        'taxonomies' => array( 'category', 'post_tag'),
        'publicly_queryable' => true,

    );
    register_post_type('football-players', $args);
    
}

Вопрос - как сделать так, что бы футбольным игрокам была возможность из админки назначать команду (что тоже по сути является постом) ?

Смотрел в сторону добавления post_tag_for_pages, но чего-то не отрабатывает.

add_action( 'init', 'post_tag_for_pages' );
function post_tag_for_pages(){
    register_taxonomy_for_object_type( 'football-players','post' );
}

Подскажите, как связывать стандартные посты, с кастомными.


Ответы (0 шт):