Search code examples
content-typestrapi

Strapi Hide Content Type


I've search for several hours how to hide a specific content type.

I found some post but they are too older and their solutions doesn't work in the actual's strapi.

For precisions, my collection type is declared inside a local plugin. I juste want to manage my collection inside the plugin page and I doesn't want it appear in the content type in the left menu.

If someone has a solution, it's can be really helpfull.


Solution

  • They are working on this: https://github.com/strapi/rfcs/pull/22

    But for now, based on official docs (plugin customization), you can overwrite file in content-manager plugin.

    Be sure to check this file on strapi updates to avoid overwriting important code.

    1. Copy file strapi-plugin-content-manager/services/data-mapper.js from your app node_modules into extensions/content-manager/services/

    2. Now edit this file in your project and add your content type to array HIDDEN_CONTENT_TYPES following this pattern: plugins::[plugin-name].[content-type] For example: plugins::ecommerce.product

    ...
    
    const HIDDEN_CONTENT_TYPES = [
      'plugins::upload.file',
      'plugins::users-permissions.permission',
      'plugins::users-permissions.role',
      'plugins::ecommerce.product',
    ];
    
    ...