[wp-trac] [WordPress Trac] #62769: Saving Post without Title and Content
WordPress Trac
noreply at wordpress.org
Thu Sep 25 06:43:21 UTC 2025
#62769: Saving Post without Title and Content
-------------------------+------------------------------
Reporter: tristup | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------------
Comment (by subrataemfluence):
@SirLouen, I completely agree with you. This check should be built into
the core of WordPress since it makes no sense to publish a post without a
title. Here is what I propose:
File location: `gutenberg/packages/editor/src/components/post-publish-
button/index.js`
Modification:
{{{
import { select } from '@wordpress/data';
export class PostPublishButton extends Component {
....
....
render() {
...
const { select } = wp.data;
const rawTitle = select( 'core/editor' ).getEditedPostAttribute(
'title ) || '';
const cleanTitle = rawTitle.trim();
const characterCount = ( cleanTitle.match(/[a-zA-Z]/g) || []
).length;
const isValidTitle = characterCount >= 5;
const isButtonDisabled =
isSaving ||
forceIsSaving ||
! isSavable ||
isPostSavingLocked ||
( ! isPublishable && ! forceIsDirty ) ||
! isValidTitle;
...
}
}
}}}
I have added a check for an input length of 5 characters. This can be
changed or left out. Furthermore, I have truncated the input text, keeping
in mind that although the consecutive five spaces will likewise validate
the check, they will be semantically empty.
Let me know what you think!
cc: @tristup
Replying to [comment:8 SirLouen]:
> Although there is this classic editor plugin to help switch to classic
editor capabilities, I believe that this can be solved in core. A check
should be in place in the editor to save and throw the corresponding
error.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62769#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list