The most common reason for fields not saving is because a post type uses the default WordPress “custom fields” meta box. This meta box actually duplicates the inputs used by your fields.
If you are registering a post type, make sure custom-fields
is not in the “supports” array.
To remove the custom-fields meta box from a WordPress default post type, or one that is registered by another plugin, use remove_post_type_support()
.
This code should go in your theme’s functions.php
file, or your plugin file.
This documentation is a community effort. Please create an issue or pull request to help!