O
O
Outsider V.2018-06-23 20:04:23
WordPress
Outsider V., 2018-06-23 20:04:23

How to make it possible to add a link to the post type archive in the menu?

I say right away that I have never developed on Wordpress, but now I had to help people.
There are several custom types of posts in the admin panel, and you can add a link to an archive of a particular type in the menu by selecting the post type, the All tab and there "All positions":
5b2e7d0c63e5c402562231.png
But for one of the custom types there is no such item! There are only individual entries.
It didn't have a post archive page, so I added its initialization in the same way that other types are added:

function create_post_type_doctors() {
    register_post_type( 'doctors',
        array(
            'labels' => array(
                'name' => __( 'Doctors' ),
                'singular_name' => __( 'doctor' )
            ),
            'public' => true,
            'has_archive' => true,
            'has_archive_slug' => '',
            'show_in_menu' => true,
            'show_in_menu_page' => '',
            'show_ui' => true,
            'publicly_queryable' => true,
            'can_export' => true,
            'show_in_nav_menus' => true,
            'query_var_enabled' => '1',
            'query_var' => true,
            'permalink_epmask' => 1,
            'rest_base' => 'services',
            'exclude_from_search' => false,
            'hierarchical' => false,
            'show_in_rest' => false,
            'menu_icon' => 'dashicons-clipboard'
        )
    );



}
add_action( 'init', 'create_post_type_deals_doctors' );

The archive page is working, but I can't add the archive to the menu.
What else is needed so that the item "All entries" appears when adding to the menu? I set 'show_in_menu' => true, 'show_in_nav_menus' => true,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Outsider V., 2018-06-24
@Audiophile

It turned out that this type of post is already added automatically by some plugin from the database. Everything was configured in the admin panel in Toolset->Types of publications.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question