I'm using the full site editor for a new site. This site has several query blocks which show specific categories. The query block hard-codes the IDs of these categories into the template HTML file. I'm then using Git to sync between dev, staging, and production servers.

The problem is the category and navigation IDs are different across servers, so I have to manually set the category IDs for each server, breaking my Git workflow.

I don't want to replicate the database across servers for a bunch of reasons. Using the category slug would solve this problem, but that doesn't seem to be an option.


  • I explored using a function hook to change the query, but it seems you can only modify the output of a full site editor query block, not change the underlying query.
  • I could create a custom query block, but then I'd have to maintain it, which I'd prefer not to do.
  • Figure out something in Git (GitHub actions?) to change the IDsin the HTML templates, which feels hacky, but could work.

Is there a recommended way of handling this situation?

  • what was the hook you tried to use? A GitHub action would change the IDs for all sites that check out that repo, which isn't what you're asking about. BTW have you raised this as an issue on the github repo? This is exactly the kind of feedback/problem that they want, be sure to mention numeric IDs, not just IDs, technically a slug could be an ID which isn't what you're asking about either
    – Tom J Nowell
    Nov 9, 2022 at 14:42
  • There are some workarounds possible to use custom queries for the query-loop that I've played with, don't know if that helps here: wordpress.stackexchange.com/questions/392914/… and wordpress.stackexchange.com/q/405588/26350
    – birgire
    Nov 9, 2022 at 15:07
  • @TomJNowell I tried the "render_block" hook. But It appears that this just allows you to modify the already rendered block, not change the rendering action. As an aside, there is a pull request to add query vars to the render block which I'd expect would allow me to swap the numerical ID with the slug, but there doesn't seem to be an indication if/when it would be integrated: github.com/WordPress/wordpress-develop/pull/2185 I wasn't sure about raising it on the github repro as I wasn't sure if there was something basic I was missing. Seems like something worth requesting though.
    – Darren
    Nov 9, 2022 at 20:12
  • @birgire Ah, interesting. I will take a look.
    – Darren
    Nov 9, 2022 at 20:13
  • Did more searching and I found a request on Github for this specific thing:github.com/WordPress/gutenberg/issues/36785 The discussion includes code that seems to no longer work. I did have to modify it for 6.1 since the block data structure changed, but I was unable to get it to work: github.com/WordPress/gutenberg/issues/…
    – Darren
    Nov 9, 2022 at 21:39


Your Answer

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

Browse other questions tagged or ask your own question.