How to fix missing custom fields after upgrading to WordPress 4.8.1?

I have a custom theme that I used many times on different sites. I also have a custom plugin installed. Prior to v4.8.1 I was always able to see the custom fields in the wp admin when I would edit a post.

Since updating to 4.8.1 I am no longer able to see them.

When I edit a post, click screen options, I don’t see the custom fields option there.

I have tried on a development site switching to the default WordPress 2017 theme. When I do that I can go to the Edit Posts screen and see the Custom Fields option in the screen options menu along with all of the other options that should be there.

I’m looking through the 2017 Theme and i am not seeing anything special in there that would enable the custom fields option.

I also don’t see anything in my plugin or theme that should remove these options.

This issue came up after I updated to WP 4.8.1. Is there a new to show/hide option for the custom fields?

And just to show some more details, both my custom post type and the standard posts section do not show “custom fields” as an option under “Screen Options”. In fact they only show three things under Boxes. “Featured Image, DAV Featured Group, and Slug”.

In my plugin, this is what I have — it is wrapped in a class:

add_action('init', array($this, 'setup_post_type'));

// Setup the custom post type for the videos
    public function setup_post_type() {
        add_theme_support('post-thumbnails');
        register_post_type('thankavet', array(
            'labels' => array(
                'name' => __('Thanks Videos'),
                'singular_name' => __('Thanks Video')
            ),
            'public' => true,
            'supports' => array('title', 'editor', 'custom-fields', 'thumbnail'),
            'has_archive' => true,
            'menu_icon' => 'dashicons-format-video',
            'rewrite' => array(
                'slug' => 'thank-you'
            )
          )
        );
      }

I am still digging, but if someone knows what happened with 4.8.1 related to that screen options menu, i’d be greatful if someone offered some assistance here. I just want to get the custom fields to appear in the Edit Post screen.

Sorry I am posting this from my phone so formatting is not too hot.

Solutions Collecting From Web of "How to fix missing custom fields after upgrading to WordPress 4.8.1?"

I don’t think it’s the WordPress 4.8.1 release doing that: but, do you have Advanced Custom Fields Installed? If you do, their release 5.6.0 hides the default WordPress custom fields meta box by default.

remove_wp_meta_box

We added in a new setting in v5.5.13 allowing the default WP custom
field metabox to be removed. Although simple, this can drastically
speed up the load times of the post edit page! From Advanced Custom
Fields version 5.6, this setting will be set to true by default.

Ref: https://www.advancedcustomfields.com/blog/acf-pro-5-6-0-ui-ux/

To bring back the normal WordPress custom fields meta box you can set that filter back to false by adding the following line into your themes functions.php file:

add_filter('acf/settings/remove_wp_meta_box', '__return_false');

Note that you don’t need to create a function called __return_false for your filter. WordPress already has a core function __return_false, which not surprisingly returns the boolean value false when called.

Ref: https://codex.wordpress.org/Function_Reference/_return_false