I'm currently creating a child theme in WordPress and I'm having trouble with template parts and custom templates from parent theme. In particular, I want to disable some of the template parts provided by the parent theme. However, since WordPress merges the JSON files of the parent and child themes, I can't simply "remove" the template parts I don't want to use.

I don't want to solve this problem by "brute force" aka PHP coding. I am trying to achieve this by simply moving files around within folders or editing theme.json. Of course, changing the parent theme is out of the question.

Solved for custom templates

I've noticed that other users have a similar problem, but I've "somehow" solved the part of a problem in question here.

And here is the trick I used to solve it. To disable certain custom templates, I came up with a workaround. It involves specifying a dummy condition. For example, in the "postType" key, I use a value that ensures that the parent templates won't be displayed to the user. Here is how I implemented this:

"customTemplates": [
    "name": "blank",
    "title": "Blank Page
    "name": "no-title",
    "title": "Successfully removed",
    "postTypes": [
    "name "single.sidebar",
    "title": "Sidebar page",
    "postTypes": [

... and just like that, template no-title is gone :)

Still no solution for template parts

However, I'm stuck when it comes to disabling template parts. Some of them I don't want to use, but these parts only consist of the keys name, title and area. Since area is predefined ("header", "footer" and "uncategorized") and cannot be freely chosen, I can't use the same trick as above.

Does anyone have any suggestions on how to disable certain template parts in a child theme using theme.json in WordPress with Gutenberg? Any input would be greatly appreciated.

  • I've just found out that my "solution" is far from complete. I mean, the user doesn't see the custom templates when entering posts, but they're still visible in the "Site Edit" area :(
    – Vladan
    Commented Jun 2, 2023 at 12:07
  • doing this without PHP will be almost impossible (may actually be impossible), and makes the question 100x harder to answer as it eliminates using a hooks/filter to remove the unwanted template. What's the reason for wanting to remove a template from the parent theme? Given that the intended future in core is that templates saved by the user may even survive a theme switch in the future, you may find that even switching from the parent to the child theme causes unintended problems in the future
    – Tom J Nowell
    Commented Jun 2, 2023 at 12:53

1 Answer 1


Does anyone have any suggestions on how to disable certain template parts in a child theme using theme.json in WordPress with Gutenberg?

Using only theme.json this is not possible, and runs counter to the vision for full site editing.

In the future it's possible that not only the parent theme templates might be visible, but the templates of previous themes that the user has modified and saved. This has been talked about a lot by the designers working on the site editor, though we haven't seen it implemented yet. This does mean that at the time of writing it's extremely unlikely that it can be done entirely using theme.json, and that they might even consider it a bug to be fixed if a way was discovered.

That's not to say this can't be done with PHP filters though, but it can't be done with just theme.json.

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.