Custom Post Type - markhowellsmead/helpers GitHub Wiki

Capabilities

Disallow “view” and archive links

Typical use: on a Custom Post Type which has been registered by a Plugin, the Plugin allows a single view, but you don't want a single view with your Theme. This will remove “view” / “preview” links in WordPress admin, amongst other things.

add_filter('register_post_type_args', function ($args, $post_type) {
    if ($post_type == 'my_custom_post_type') {
	    $args['publicly_queryable'] = false;
    }
    return $args;
}, 10, 2);

Labels

'labels' => [
    'name' => _x('Beiträge', 'General name for the post type, usually plural. The same and overridden by $post_type_object->label.', 'sha'),
    'singular_name' => _x('Beitrag', 'Name for one object of this post type.', 'sha'),
    'add_new' => _x('Neu hinzufügen', 'Default is ‘Add New’ for both hierarchical and non-hierarchical types. When internationalizing this string, please use a gettext context matching your post type.', 'sha'),
    'add_new_item' => _x('Neuer Beitrag hinzufügen', 'Label for adding a new singular item.', 'sha'),
    'edit_item' => _x('Bearbeiten', 'Label for editing a singular item.', 'sha'),
    'new_item' => _x('Neu', 'Label for the new item page title.', 'sha'),
    'view_item' => _x('Beitrag anzeigen', 'Label for viewing a singular item.', 'sha'),
    'view_items' => _x('Beiträge anzeigen', 'Label for viewing post type archives.', 'sha'),
    'search_items' => _x('Beiträge durchsuchen', 'Label for searching plural items.', 'sha'),
    'not_found' => _x('Keine Beiträge gefunden', 'Label used when no items are found.', 'sha'),
    'not_found_in_trash' => _x('Keine Beiträge im Papierkorb gefunden', 'Label used when no items are in the Trash.', 'sha'),
    'parent_item_colon' => _x('Übergeordneter Beitrag', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical post types.', 'sha'),
    'all_items' => _x('Alle Beiträge', 'Label to signify all items in a submenu link.', 'sha'),
    'archives' => _x('Beitragsarchiv', 'Label for archives in nav menus.', 'sha'),
    'attributes' => _x('Beitrags-Attribute', 'Label for the attributes meta box.', 'sha'),
    'insert_into_item' => _x('In den Beitrag einfügen', 'Label for the media frame button.', 'sha'),
    'uploaded_to_this_item' => _x('Zu diesem Beitrag hochgeladen', 'Label for the media frame filter.', 'sha'),
    'featured_image' => _x('Beitragsbild', 'Label for the featured image meta box title.', 'sha'),
    'set_featured_image' => _x('Beitragsbild setzen', 'Label for setting the featured image.', 'sha'),
    'remove_featured_image' => _x('Beitragsbild entfernen', 'Label for removing the featured image.', 'sha'),
    'use_featured_image' => _x('Als Beitragsbild anwenden', 'Label in the media frame for using a featured image.', 'sha'),
    'menu_name' => _x('Beiträge', 'Label for the menu name.', 'sha'),
    'filter_items_list' => _x('Beitragsliste filtrieren', 'Label for the table views hidden heading.', 'sha'),
    'items_list_navigation' => _x('Navigation Beitragsliste', 'Label for the table pagination hidden heading.', 'sha'),
    'items_list' => _x('Beitragsliste', 'Label for the table hidden heading.', 'sha'),
    'item_published' => _x('Beitrag veröffentlicht.', 'Label used when an item is published.', 'sha'),
    'item_published_privately' => _x('Beitrag privat veröffentlicht', 'Label used when an item is published with private visibility.', 'sha'),
    'item_reverted_to_draft' => _x('Beitrag zum Entwurf geändert.', 'Label used when an item is switched to a draft.', 'sha'),
    'item_scheduled' => _x('Beitrag terminiert.', 'Label used when an item is scheduled for publishing.', 'sha'),
    'item_updated' => _x('Beitrag aktualisiert.', 'Label used when an item is updated.', 'sha'),
]