I am trying to get gutenberg block editor
to show the post custom field
, but it doesn't work!!!
When I go to options (3 little dots on the upper right corner of screen) > preferences > custom field option
it asks me to reload the page and then after the page reloads, nothing happens, no custom field shows up and in the preferences it's still unchecked!!!
Tried to find some documentation on this issue, no luck so far!!!
Does anybody know why?
Is this a glitch in the new version of wordpress and gutenberg block editor?
For future reference:
ACF plugin
is causing this behavior, so when I got it deactivated, wordpress native custom fields
appeared.
So I decided to use ACF
instead of native custom fields
. I hope this helps anyone who runs into this and clears up some confusion!
We could use the following solution to bring back wordpress native custom fields
:
add_filter("acf/settings/remove_wp_meta_box", '__return_false', 999);
Use this flter hook
in your functions.php
file of your active theme.
Tested and works seamlessly! ;-)
When you activate ACF plugin
, it decides to hide wordpress native custom fields
! Super odd!
So here's what happens when you activate ACF plugin
:
1- It first sets an option 'remove_wp_meta_box'=> true
from its acf.php
file.
2- Then, it tries to hide/unset the wordpress native custom fields
from its field_group_options.php
file, like this:
if ( acf_get_setting( 'remove_wp_meta_box' ) ) {
unset( $choices['custom_fields'] );
}
3- It also has a filter hook
when using acf_get_setting
function in its api-helpers.php
file.
apply_filters( "acf/settings/{$name}", $value );
We could take advantage of this filter hook
to bring back the wordpress native custom fields
, like this:
add_filter("acf/settings/remove_wp_meta_box", '__return_false', 999);