How to Fix Custom Fields Not Showing in WordPress
Custom fields are a feature present in WordPress for quite a long time. They allow you to add customized pieces of information or content to pages, posts, or custom post types. For example, you can add specific dates, names, messages, or other information referred to as the metadata of a given page or post. And, while these custom details can greatly enrich an existing page or post, to make full use of custom fields WordPress users need considerable coding experience.
This, in turn, made custom fields undesirable, confusing, or even, frightening for most users. For this reason, starting from the WordPress 3.1 release, custom fields have been hidden within the WordPress interface by default. Nevertheless, you can still use them after displaying their section. With that in mind, we have decided to create this article in order to explain how you can fix the fact that custom fields aren’t showing in WordPress by default.
Custom fields are a great asset to website development but are mostly reserved for advanced WordPress users. Nevertheless, you can re-enable them in just a few steps. The Custom fields section can be enabled in two separate ways, depending on which editor (Gutenberg or Classic, enabled by installing the Classic Editor plugin) you use. We will explain both methods below, leaving you with the choice of which to use based on your preference.
Apart from that, we will also cover how you can re-enable them if they have been disabled by a WordPress plugin.
This is what we’d like to discuss:
If you are using the new Gutenberg editor screen, then, you can enable the Custom Fields section from the Options section. To do so, click on the 3-dots link in the top-right corner of your screen while editing a page or post.
This will open the Options menu. Afterward, locate and select the “Preferences” option.
Having done that, the Preferences section will open in a popup window. It contains four tabs: General, Appearance, Blocks, and Panels, with the first being selected by default. To access the Custom fields option, click on the Panels tab.
Then, locate the “Custom fields” option within the Additional subsection. To enable the Custom fields, toggle the option either by pressing on the toggle icon or the option label itself.
However, the Custom fields section won’t be enabled immediately. Instead, you will see an additional “Enable and Reload” button below, meaning that enabling this section while in Gutenberg editing mode requires a full page reload. However, if you have any unsaved edits on the current page, pressing this button is not advised, as you will lose your editing work. Click the “Update” button to update the page/post if you want to save your edits. Then, proceed as described above, and, having toggled the Custom fields, press the “Enable & Reload” button to reload the page and save the preference choice.
Then, once the page reloads, you will be able to see the Custom Fields section below the page content.
If you are using the Classic Editor plugin to edit your pages and posts using the old TinyMCE editor, you can enable the Custom fields section from Screen Options. While editing a page or post, locate the Screen Options link in the top-right corner of the screen and click on it.
By doing so, you will expand the Screen Options section. Then, locate the Custom Fields option within the Screen elements subsection and click on it to activate it.
Having done so, the Custom Fields section will appear below the post content, this time without reloading the page.
Apart from the default WordPress custom fields, there is a plethora of WordPress plugins, both free and premium, which offer a way to implement custom fields with specialized interfaces and added functionalities beyond the default ones. Thus, depending on your preference, you could use either or both.
However, as some WordPress custom fields plugins disable or hide the default WordPress custom fields section, it is important to consult with the plugin authors on how to prevent this behavior in case you wish to use both custom fields sections. Of course, before consulting with the plugin authors, make sure that you have correctly pinpointed the exact WordPress plugin that blocks the default custom fields section by performing the basic troubleshooting steps.
Having said that, let us explain how you can resolve this issue in the specific case of the ACF plugin.
The Advanced Custom Fields, or ACF, is a freemium plugin which allows you to quickly add plugin-specific custom fields to pages, posts, users, taxonomy terms, comments, media, and other pages. Apart from the basic input text field present in WordPress by default, it comes with additional field types, some of which are only available in the premium version. It also has extensive documentation with explanations and coding examples for those fields. It is no wonder, therefore, that ACF is a well-known custom fields plugin with over 2 million active installations, often used to replace the default WordPress Custom Fields section. However, for users who want to use both, we will explain how you can re-enable the WordPress custom fields the plugin disables upon activation.
As noted in their documentation, the removal of the default Custom Fields meta box was implemented in the 5.5.13 plugin version to speed up the load times of the post edit screen and was set as the default plugin behavior in version 5.6.0. Therefore, you won’t be able to access the default Custom Fields section using either of the editor modes we previously discussed.
Specifically, if you are using the Classic Editor plugin, you won’t be able to see the Custom Fields option in Screen Options or as a section below the page/post content.
And if you are using the Gutenberg edit screen, the Custom Fields sections won’t be available under the page/post content after activating the plugin.
Luckily, the solution for both variations of this problem is very simple – adding a small code snippet given in the plugin’s documentation. You can add it either in the functions.php file of your child theme or a site-specific plugin. We will explain the former method below. But, before we go over the steps, we strongly advise making a backup of your website as a precautionary measure. Having done that, proceed with adding code.
To enable the default Custom Fields section while using the ACF plugin, first, connect to the server using your FTP credentials and navigate to the root WordPress directory of your website.
Then, navigate to the /wp-content/themes directory, locate the directory of your child theme and click to access it.
Locate the functions.php file within it, right-click the file and select the “View/Edit” option from the menu which will appear.
Then, open the file using your preferred text editor and insert the following line of code at the end of the file.
add_filter('acf/settings/remove_wp_meta_box', '__return_false');
Afterwards, save the changes you have made and upload the file back to the server, overriding the one currently there. Having done that, you will be able to access the Custom fields section as discussed in the previous section.
To elaborate briefly, this line of code sets the value of the remove_wp_meta_box plugin option to false, i.e. disables it, using a filter hook. Thus, by disabling the option which removes the Custom Fields meta box, you will once more be able to see this section and use it as you see fit. Having said that, we conclude this article.
Final Thoughts
WordPress custom fields can be used to add custom pieces of information to pages, posts, or custom post types using suitable code snippets. They are often used by advanced WordPress users but hold little value to novice ones, which is why the Custom Fields section is disabled by default.
Thankfully, you can re-enable it by taking the few steps we covered in this article. And, while these steps differ significantly depending on which edit screen you are using, we have covered both, so that you can choose the one best suited for your website. Furthermore, we have also covered the interaction between the WordPress custom fields and the ones provided by the ACF plugin, in case you opt to use both. Therefore, we are sure you will be able to display the WordPress Custom Fields section properly and use it to add customized data to your website.