I find a way to get the $args
of an existing custom post type.
I tried first to use the get_post_types()
function, but it was always listing the built-in post types even when I pass the '_builtin' => false
in the function args like this:
$args = array(
'_builtin' => false
);
$post_types = get_post_types( $args );
I found that we can use global $wp_post_types
like this:
$wp_post_types['custom_post_type_slug']->arg_slug;
.
For example:
$wp_post_types['custom_post_type_slug']->labels;
$wp_post_types['custom_post_type_slug']->menu_icon;
$wp_post_types['custom_post_type_slug']->show_in_menu;
...