Solution 1 :

You need to add an action that fires this register post type function.
We typically do this on init.


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

Just add that after your latest_work function so that WordPress fires it on Init

Problem :

I am typing code function.php file and but it’s not working (custom-fields,menu-position). I am going to the WordPress admin panel and Lates Work menu labels. I’m adding a new item page here, but it’s not showing custom fields. How to solve this problem?

// Register Post Type

    'labels' => array(
        'menu_name'     => 'Lates Work Menu ',
        'name'          =>  'Lates work',
        'add_new'       =>  'Add new',
        'all_items'     =>  'All lates work',
        'add_new_item'  =>  'Add new item',

    'public'             => true,
    'menu_icon' => 'dashicons-book',
    'publicly_queryable' => true,
    'show_ui'            => true,
    'show_in_menu'       => true,
    'query_var'          => true,
    'capability_type'    => 'post',
    'has_archive'        => true,
    'hierarchical'       => false,
    'menu_position'      => null,
    'supports'           => array( 'title','custom-fields', 'author', 'thumbnail', 'excerpt', 'comments' ),


custom fields not showing add new item===