
I have a Post Type “gig” which creates posts comprised of several custom fields for a musician’s event calendar My frontend display does not need the standard WP post title. Use of content from the standard block editor is optional.
The problem: WP won’t allow saving posts if the block editor if both the block editor and title are empty.
Surely this is a problem that ACF has already solved?
I have tried the following code in a custom plugin without success:
public function allow_empty_gig_content($maybe_empty, $postarr) {
// Allow gig posts to be saved with empty content
if (isset($postarr['post_type']) && $postarr['post_type'] === 'gig') {
return false;
}
return $maybe_empty;
}
add_filter('wp_insert_post_empty_content', array($this, 'allow_empty_gig_content'), 10, 2);
I have experimented with unchecking “Title” and “Editor” in the post type’s Advanced Settings > General > Supports, and I thought I had it working for a moment, but after further experimentation with these, I cannot make it work. Perhaps something in my CPT definition has been corrupted?