I'm working through the 'getting started' tutorial and I've run into an error I can't get passed. I've created the Category Group: 'Topics' and then created the Field 'PostCategories' and connected it to the Topics Category Group. I've added this to my 'post' entry type along with the other fields mentioned in the Tutorial.

I've copied the code for the '_entry.twig' template (see attached) which when I run throws a runtime error: Calling unknown method: craft\elements\Entry::topics()'

I had noticed that there was an inconsistency in the instructions for creating the 'Category Group' but even when I changed to match either option shown for creating a 'Category URI Format' the error appeared. There's an inconsistency in the instructions hereThis is the code that declares the 'Topic' variable, then calls it in a loop

I'm a total noob at this so thanks in advance for any pointers.

1 Answer 1


The error message indicates that a field with the handle topics doesn't exist. You need to use the field handle defined in the field's settings. Go to Settings ⇾ Fields ⇾ Topics (the name of your field), the second input below the name will show you the field handle you need to use, and allow you to change it.

You can also display field handles in element forms in the Control Panel as a convenience. Go to your profile settings and activate the option Show field handles in edit forms, which is inactive by default.

  • 1
    Thanks for this - I changed setting the variable value to that of the field handle and that worked - thanks. Definitely different from how the Tutorial says to do it.
    – GeordieJS
    Commented Sep 5, 2023 at 14:42
  • @GeordieJS The tutorial shows the handle topics in the screenshot for the categories field: craftcms.com/docs/getting-started-tutorial/configure/… And this should be the default handle that is created when you enter Topics as the field name. The handle is only generated based on the field name when the field is created, after that you have to update it manually if you want to use a different handle.
    – MoritzLost
    Commented Sep 6, 2023 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.