I have created a custom post type with php and my problem is that this post type is not appearing in the menu of Toolset Types Plugin. I think that must be some option that I have to fill but I have tried with almost everything and I don´t know why this is happening.

I want to edit the relationship between post types, specially between cars and news.

My code to create the custom post type is this.

function car_post_type() {
    $labels = array(
        'name' => 'Coches',
        'singular_name' => 'Coche',
        'menu_name' => 'Coches',
        'name_admin_bar' => 'Coches',
        'parent_item_colon' => 'Padre:',
        'all_items' => 'Todos los coches',
        'add_new_item' => 'Añadir nuevo coche',
        'add_new' => 'Añadir coche',
        'new_item' => 'Nuevo coche',
        'edit_item' => 'Editar coche',
        'update_item' => 'Actualizar coche',
        'view_item' => 'Ver coche',
        'search_items' => 'Buscar coches',
        'not_found' => 'No hay resultados',
        'not_found_in_trash' => 'No se han encontrado coches en la papelera',
    $rewrite = array(
        'slug' => 'coche',
        'with_front' => true,
        'pages' => true,
        'feeds' => true,
    $args = array(
        'label' => __( 'Car', 'clever' ),
        'description' => __( 'Cars', 'clever' ),
        'labels' => $labels,
        'supports' => array(
            'title', 'editor', 'excerpt', 'thumbnail', 'revisions',
        'taxonomies' => array(),
        'hierarchical' => false,
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 5,
        'menu_icon' => 'dashicons-dashboard',
        'show_in_admin_bar' => true,
        'show_in_nav_menus' => true,
        'can_export' => true,
        'has_archive' => true,
        'exclude_from_search' => false,
        'publicly_queryable' => true,
        'rewrite' => $rewrite,
        'capability_type' => 'post',

    register_post_type('car', $args);
add_action('init', 'car_post_type', 0);

Thanks for your help.

  • Your registration seems fine, the usual things that hide them from get_post/WP_Query calls are all good. I would look into how the plugin creates its list of post types. Does it even allow for custom post types? – hwl Aug 2 '17 at 12:04
  • If you create the post type with the plugin, it works. But if you do it in PHP it does not appear. – Paco Gómez Capón Aug 2 '17 at 12:13
  • That seems to be because when registering through plugin, it is creating a option with an array value of names, and then calling that to both create the menu first, and then to register the types and taxonomies. Your post type is not in their options, so it won't be added. It doesn't appear to check for post types created outside itself. – hwl Aug 2 '17 at 13:25
  • So, do I have to generate that option? how can i do it? – Paco Gómez Capón Aug 2 '17 at 13:29
  • get_option( WPCF_OPTION_NAME_CUSTOM_TYPES, array() ); search the plugin directory for that line and you will see what I mean. There is a filter you can hook though: $data = apply_filters( 'types_post_type', $data, $post_type ); at the top of wpcf_custom_types_register() in /library/toolset/types/embedded/includes/custom-types.php line 223 – hwl Aug 2 '17 at 13:30

I have found a solution with ACF plugin, this plugin allow to create relationships between post types when one of the post types is created with php.

You can download the plugin from here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.