0

I would like to add a category (is that what it's called?) such as 'Articles' to the WordPress menu.

Not the one that will be visible to the end user, but this menu:

enter image description here

Ty

1 Answer 1

1

You would need to create a custom post type by adding this code to your functions.php file (only do this if you are comfortable with editing theme files if not you should use a plugin such as "Custom Post Type UI"):

 function custom_post_type() {

    $labels = array(
        'name' => 'Articles',
        'singular_name' => 'Article',
        'add_new' => 'Add New',
        'add_new_item' => 'Add New Article',
        'edit_item' => 'Edit Article',
        'new_item' => 'New Article',
        'view_item' => 'View Article',
        'search_items' => 'Search Articles',
        'not_found' => 'No Articles found',
        'not_found_in_trash' => 'No Articles found in Trash',
        'parent_item_colon' => '',
        'menu_name' => 'Articles'
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'has_archive' => true,
        'publicly_queryable' => true,
        'query_var' => true,
        'rewrite' => array('slug' => 'articles'),
        'capability_type' => 'post',
        'hierarchical' => false,
        'supports' => array(
            'title',
            'editor',
            'thumbnail',
            'excerpt',
            'custom-fields'
        ),
        'menu_position' => 5,
        'exclude_from_search' => false
    );

    register_post_type('articles', $args);
}

add_action('init', 'custom_post_type');

This is just an example and you should edit the options in the function to what you need from the custom post type. You can refer to Wordpress documentation : https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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