Tiffin Consulting

digital business transformation

Modify a Custom Post Type Registration with the registered_post_type Hook

add_action( 'registered_post_type', 'gs_books_label_rename', 10, 2 );

/**
* Modify registered post type menu label
*
* @param string $post_type Registered post type name.
* @param array $args Array of post type parameters.
*/

function gs_books_label_rename( $post_type, $args {
  if ( 'gs_books' === $post_type ) {
    global $wp_post_types;
    $args->labels->menu_name = __( 'Books', 'gs_books' );
    $wp_post_types[ $post_type ] = $args;    
  }
}

via Use registered_post_type Hook to Modify Post Type Registration – WP Smith.