I don’t see this is a server problem – before a post is published, trying to open that post is going to give you a response of 404 rather than 200, no matter what you do.
The only workaround as it stands is to publish a post before you can use multiple content blocks on that page. This should be fine for pages, where in most cases they won’t appear in a site’s navigation until you add them to menus (unless those menus automatically add top-level pages), but it’s a problem for any custom post types or even normal posts which populate lists the minute they’re published. Add in RSS and so on and you’ve got real problems where you have to publish unfinished content and broadcast it before it’s done.
To fix this, I can see a couple of possible options:
1. Write in a fallback function which uses file_get_contents
, fopen()
or similar to read the template files to check for occurrences of the the_block
or get_the_block functions
. Grab the name and create the custom post meta. HOWEVER this relies on knowing the file name of the template you’re supposed to be reading – you can go through the usual page, single, post etc but it’s more than likely you’ll miss some.
2. Add an admin menu where you name your extra blocks up front as well as in your template files.
The other option is to put the custom post meta in your theme files and add content blocks yourself rather than using this plugin.
I may have missed something, however, and I’m happy to be corrected!