0

I have a theme on WordPress 4.4 which has this file included in functions.php:

<?php
function post_types(){
  $labels = array(
        'name'               => __( 'Newsletters'),
        'singular_name'      => __( 'Newsletter'),
        'menu_name'          => __( 'Newsletters'),
        'name_admin_bar'     => __( 'Newsletter'),
        'add_new'            => __( 'Add New'),
        'add_new_item'       => __( 'Add New Newsletter'),
        'new_item'           => __( 'New Newsletter'),
        'edit_item'          => __( 'Edit Newsletter'),
        'view_item'          => __( 'View Newsletter'),
        'all_items'          => __( 'All Newsletters'),
        'search_items'       => __( 'Search Newsletters'),
        'parent_item_colon'  => __( 'Parent Newsletters'),
        'not_found'          => __( 'No Newsletters found.'),
        'not_found_in_trash' => __( 'No Newsletters found in Trash.')
    );

  $args = array(
        'labels'             => $labels,
        'public'             => true,
        'show_in_menu'       => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'newsletter' ),
        'capability_type'    => array('newsletter','newsletters'),
        'has_archive'        => true,
        'hierarchical'       => true,
        'menu_position'      => 5,
        'supports'           => array( 'title','thumbnail','comments','editor','excerpt' )
    );

    register_post_type( 'newsletter', $args );
}
add_action('init', 'post_types');
?>

Newsletters does not appear anywhere on my admin menu and I'm not sure what I am doing wrong.

1 Answer 1

1

The problem is most likely this part:

'capability_type'     => array('newsletter','newsletters'),

Try to remove it or adjust it accordingly.

You should also prefix your functions to avoid possible name collisions. So replace:

function post_type() {

to e.g.

function arcath_post_type() {

and similarly:

add_action('init', 'arcath_post_types');
0

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.