I need to register a custom post type, said "hidden_cpt", which to be :
- not visible to public site
- no admin menu
- only accessible via query_posts or wp_query
- visible by acf (or similar technical low level plugin)
I've try to do some test with register_post_type args, but it's either too hidden or not enough ...
Do you have an idea ?
Thank's in advance
EDIT: I tried around the following code, changing some "true" to "false" and vice versa... but I did not keep all my tests :-( This one is not the best one...
function register_hidden_cpt() {
$labels = [
"name" => __("HCPT", "hidden_cpt"),
"singular_name" => __("HCPT", "hidden_cpt"),
"menu_name" => __("HCPT", "hidden_cpt"),
];
$args = [
"label" => __("HCPT", "hidden_cpt"),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"delete_with_user" => false,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => false,
"query_var" => true,
"supports" => ["title", "editor", "thumbnail"],
];
register_post_type("hidden_cpt", $args);
}
add_action('init', 'register_hidden_cpt');