Custom Post Types returning 500 Error

I’m attempting to build a new site in Wordpress with Frontity; however, I’m running into an issue.

I’m using @frontity/mars-theme as my theme.

The site I am building has a plugin called “Cooked” which creates a custom postType of cp_recipe with an endpoint of cooked_recipe.

I have added this to my frontity.settings.js for wp-source:

{
      "name": "@frontity/wp-source",
      "state": {
        "source": {
          "api": "http://localhost/wp-json",
          "params": {
            "per_page": 5,
            "type": ["post", "page", "cp_recipe"]
          },
          "homepage": "/home",
          "postTypes": [
            {
              "type": "cp_recipe",
              "endpoint": "cooked_recipe"
            }
          ]
        }
      }
    }

However, when I browse to one of these recipes using its slug (ie: http://localhost:3000/cp_recipe/pan-seared-bonafidebbq-chicken) I get an internal server error and the console outputs:

  TypeError: Cannot read property 'split' of undefined
      at __webpack_exports__.default (webpack-internal:///./node_modules/@frontity/wp-source/src/libraries/handlers/utils/capitalize.ts:2:73)
      at Object.eval (webpack-internal:///./node_modules/@frontity/wp-source/src/libraries/handlers/postType.ts:10:205)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at eval (webpack-internal:///./node_modules/@frontity/wp-source/src/actions.ts:22:101)

Reading the forums, and several Github issues, I’ve seen many people mention this error but no clear way as to how to troubleshoot or resolve it.

Hi @BillyJBryant

If you could provide a repository with the code of your project, the community (or any member of the Frontity team) would be able to clone your project and try to reproduce the issue you’re having
With this info, it’ll be much easier to help you with your issue

If you can’t share your whole project, please create a CodeSandbox (you can start with this template) or a GitHub repository with the minimal amount of code to reproduce the issue.

1 Like

I dont see a resolution here but maybe similar to my problem so linking them here:

Custom Post Types return 404 in Frontity custom slug not found