[wp-trac] [WordPress Trac] #37027: Deletion of post with no title, content & excerpt
WordPress Trac
noreply at wordpress.org
Sat Jun 4 13:28:24 UTC 2016
#37027: Deletion of post with no title, content & excerpt
----------------------------+------------------------
Reporter: Ninos Ego | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Administration | Version: 4.5.2
Severity: normal | Resolution: duplicate
Keywords: | Focuses:
----------------------------+------------------------
Changes (by Ninos Ego):
* version: => 4.5.2
* component: Posts, Post Types => Administration
Comment:
User-based solution:
{{{#!php
<?php
/**
* Allow empty posts in insert function
*
* @since 1.0.0
* @access public
*
* @param boolean
* @param array
*
* @return boolean
*/
add_filter( 'wp_insert_post_empty_content', 'allow_empty_post', 10, 2 );
function allow_empty_post( $maybe_empty, $postarr ) {
if ( ! $maybe_empty ) {
return $maybe_empty;
}
if ( 'YOURPOSTTYPE' === $postarr['post_type']
&& in_array( $postarr['post_status'], array( 'inherit',
'draft', 'trash', 'auto-draft' ) )
) {
$maybe_empty = false;
}
return $maybe_empty;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37027#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list