I am using WordPress for documenting a project. To lighten the workload, I plan to run a script to build a big old index of things. For example, "files that call function_x", or "files with @todo in them" - that sort of thing. Each of these will have a post made for them.

I have already created a set of reusable blocks that should be added to posts that are incomplete or automatically added (among other things). What I cannot figure out is how to add a known reusable block to a post when creating it in code.

How do I programmatically add a reusable block to a post?

  • 1
    have you tried adding the HTML comment with the ID swapped out for the reusable block you prefer?
    – Tom J Nowell
    Mar 14, 2021 at 17:36
  • No, but that sounds like it might work. Mar 14, 2021 at 18:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.