We have a custom post type (in this case called “item”) that we want to only make available for members of the website. We changed the boolean ‘public’ from “true” to “false” but this will make the custom post unavailable even to the users. Is there any option to make the custom post only available to the members?
register_post_type('item', Array(
'public' => true,
'menu_icon' => '',
'labels' => $labels,
'supports' => Array(
'title', 'editor', 'thumbnail',
), 'rewrite' => array('slug' => $javo_item_slug , 'with_front' => false )
, 'query_var' => true
, 'taxonomies' => Array( 'post_tag')
));
// item > Category
register_taxonomy('item_category', 'item', Array(
'label' => __( 'Item Category', "javo_fr" )
, 'labels' => Array(
'menu_name' => __('Category', 'javo_fr')
)
, 'rewrite' => array( 'slug' => $javo_item_slug.'_category' )
, 'hierarchical' => true
));
// item > location
register_taxonomy('item_location', 'item', Array(
'label' => __( 'Item Location', "javo_fr" )
, 'labels' => Array(
'menu_name' => __('Location', 'javo_fr')
)
, 'rewrite' => array( 'slug' => $javo_item_slug.'_location' ),
'hierarchical' => true,
));
// Custom label for Post Tags
$wp_taxonomies['post_tag']->labels = (object) Array(
"name" => __('Keywords', 'javo_fr')
, "singular_name" => __('Keyword', 'javo_fr')
, "search_items" => __('Search Keywords', 'javo_fr')
, "popular_items" => __('Popular Keywords', 'javo_fr')
, "all_items" => __('All Keywords', 'javo_fr')
, "parent_item" => NULL
, "parent_item_colon" => NULL
, "edit_item" => __('Edit Keyword', 'javo_fr')
, "view_item" => __('View Keyword', 'javo_fr')
, "update_item" => __('Update Keyword', 'javo_fr')
, "add_new_item" => __('Add New Keyword', 'javo_fr')
, "new_item_name" => __('New Keyword Name', 'javo_fr')
, "separate_items_with_commas" => __('Separate keywords with commas', 'javo_fr')
, "add_or_remove_items" => __('Add or remove keywords', 'javo_fr')
, "choose_from_most_used" => __('Chose from the most used keywords', 'javo_fr')
, "not_found" => __('No keywords found', 'javo_fr')
, "menu_name" => __('Keywords', 'javo_fr')
, "name_admin_bar" => "post_tag"
);