-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set_context('carbon_fields_after_title') causes blank add/edit post/page/cpt screen #851
set_context('carbon_fields_after_title') causes blank add/edit post/page/cpt screen #851
Comments
Hi, I'm afraid that currently you can't change container position to be above the Gutenberg editor if that's your intention. |
Unfortunately that was the intent. I wasn’t sure if the problem was here with Carbon Fields or with Gutenberg. As opposed to simply not working it does fail a bit more harshly. I’ll go ahead and close this out since it is not possible (yet I hope) to use that option in this way. It does work just fine with Gutenberg disabled. I’ll also leave a suggestion of a doc mention since Gutenberg being enabled is the default now. |
I’d been away from WP long enough that I’m coming back with Gutenberg as new to me, so grabbing onto these new concepts is a bit bumpy though more in line with what I’m used to these days on the browser side. Looks like the way Gutenberg wants to do this is through “meta blocks”. https://developer.wordpress.org/block-editor/tutorials/metabox/meta-block-3-add/ There seem to be some troubles here with hi consistency and non-optional fields. Will keep looking at this in the morning. |
Hi, as far as I understand you need to create a Gutenberg Block not a Post Meta Container. For that purpose you can use the Carbon Fields Gutenberg Blocks instead -- https://docs.carbonfields.net/#/containers/gutenberg-blocks |
Yes, that’s what I’ve gleaned thus far. Now to see if the functionality I need in this way is also supported by Gutenberg and by Carbon Fields. At the root I feel weird about it being a block, as for this case it should not be reusable in any other way than as a required and always present meta field within a specific CPT. It looks like there are ways to accomplish this at least in part. I digress, that is a bit outside the scope of this ticket as I originally wrote it, but I’ll at least update again once I have a suitable base replacement for the broader scope for anyone who searches for it. |
The solution is to use Gutenberg blocks, and possibly a block template, and possibly template lock. Relevant doc linked below. Unfortunately it is not possible to lock specific blocks using a template, however you can place one or more group blocks ( https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ |
Version
Expected Behavior
Add post/page/cpt screen functions as intended
Actual Behavior
Add post/page/cpt screen is blank, and errors are present in the browser console.
First error is:
Minimal Repro
This is a repro as a plugin. As written it requires Carbon Fields to be installed via Composer.
The critical line here is the call to
set_context
.Steps to Reproduce the Problem
Comments
Error can be prevented by disabling Gutenberg, disabling the
set_context
call, or by using a context other thancarbon_fields_after_title
.Related Issues
#631
Other values seem to work fine, so it appears that context is now meaningful again.
#735
This appears to be directly related, and results in same errors, but the conditions are not the same. Using
where
is not required to cause the issue, nor does it resolve it.The text was updated successfully, but these errors were encountered: