WordPress allows empty title posts to publish
-
I can understand WP allowing empty titles on a draft, since it might not be determined yet. However, at publish time, it should not allow an empty title for a post.
I can’t determine any point to where a plugin (action hook, etc.) can be made to check for this condition. I think a slight modification to the core code is prudent.
wp-includes/post.php:
if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) return 0;
Should be something like:
if($post_status == 'publish') { if ( ('' == $post_content) || ('' == $post_title) || ('' == $post_excerpt) ) return 0; } else { if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) return 0; }
Optionally it can ignore needing to check to make sure there is content in the post body. But an empty title means that the links to click on the title are blank too… it doesn’t make sense (nor can it really make a useful post slug out of that!)
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘WordPress allows empty title posts to publish’ is closed to new replies.