Configuring the pluginCreating Custom Internal Endpoints for Blocks
Creating Custom Internal Endpoints for Blocks
Similar to the blockEditor internal endpoint, developers can also create their own pre-defined internal endpoints (to feed data to their application or blocks), as to apply a specific configuration:
Using nested mutations or not
Using namespacing or not
Pre-defining CPTs that can be queried
Any other configuration available in the Schema Configuration
The following PHP code defines a custom internal endpoint with name accessMyPortfolioData, that configures field Root.customPosts (from the "Custom Posts" module) to access the MyPortfolio CPT only:
It must be initialized on the plugins_loaded hook:
Finally, the endpoint is accessed by replacing param endpoint_group with the chosen name: