WordPress Custom type post unable to edit in admin panel

62 Views Asked by At

I have to come into a custom theme that is 5 years old, and it has a careers page. But the post cannot be edited. I have been looking through the theme files where the post type is registered to see if it's a permission issue, but everything seems good. I am not a WordPress developer, and any ideas would be helpful.

This is a local dev environment clean install, with only a few plugins active.

I am adding an image of what the display page looks like. The posts are created and deleted through an action that would call an API to check if there are changes and either create, delete, or update the post, and from that point, it works. It's from the admin UI that it doesn't.

register_post_type( 'crb_career', array(
    'labels' => array(
        'name'               => __( 'Careers', 'crb' ),
        'singular_name'      => __( 'Career', 'crb' ),
        'add_new'            => __( 'Add New', 'crb' ),
        'add_new_item'       => __( 'Add new Career', 'crb' ),
        'view_item'          => __( 'View Career', 'crb' ),
        'edit_item'          => __( 'Edit Career', 'crb' ),
        'new_item'           => __( 'New Career', 'crb' ),
        'view_item'          => __( 'View Career', 'crb' ),
        'search_items'       => __( 'Search Careers', 'crb' ),
        'not_found'          =>  __( 'No Careers found', 'crb' ),
        'not_found_in_trash' => __( 'No Careers found in trash', 'crb' ),
    ),
    'public'              => true,
    'exclude_from_search' => true,
    'show_ui'             => true,
    'capability_type'     => 'post',
    'capabilities'        => array(
        'create_posts' => true,
        'read_posts'   => true,
    'edit_posts'     => true,
    'delete_posts' => true,
    ),
    'hierarchical'        => false,
    '_edit_link'          => 'post.php?post=%d',
    'rewrite'             => array(
        'slug'       => 'career',
        'with_front' => false,
    ),
    'query_var' => true,
    'menu_icon' => 'dashicons-groups',
    'supports'  => array( 'title', 'editor', 'page-attributes', 'thumbnail' ),
) );

screenshot of careers admin panel

1

There are 1 best solutions below

0
On

I posted the same question to the WordPress Reddit and got the answer so I want to document it here.

Just remove all the capabilities stuff if you're setting everything to true, which is the default anyway. https://developer.wordpress.org/reference/functions/register_post_type/#capabilities

This fixed issue and the admin page works completely as expected.