[wp-trac] [WordPress Trac] #18713: No hooks available to "calculate" a post_title when only custom metaboxes in use
WordPress Trac
wp-trac at lists.automattic.com
Tue Sep 20 04:52:49 UTC 2011
#18713: No hooks available to "calculate" a post_title when only custom metaboxes
in use
------------------------------------------------+--------------------------
Reporter: mikeschinkel | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: Post Types | Review
Severity: normal | Version: 3.2.1
Keywords: has-patch dev-feedback 2nd-opinion | Resolution:
------------------------------------------------+--------------------------
Changes (by mikeschinkel):
* cc: mikeschinkel@… (added)
Comment:
FYI, here is a short term solution that I am using to bypass the code that
causes `wp_insert_post()` to bail when `$_POST['post_title'] is empty:
{{{
add_action( 'admin_init', 'myplugin_admin_init' );
function myplugin_admin_init() {
global $pagenow;
if ( count( $_POST ) && empty( $_POST['post_title'] ) ) {
if ( 'post.php' == $pagenow ) {
$_POST['post_title'] = 'To be replaced';
} else {
// This just to let me know if I need to add other tests.
wp_die( "ERROR: Unexpected value for \$pagenow when
\$_POST['post_title'] is empty: {$pagenow} " );
}
}
}
}}}
I then update the `'post_title'` field within the `'wp_insert_post_data'`
hook. Of course this is a real hack, and it doesn't let a plugin ensure
that the custom post type can be saved correctly when wp_insert_post() is
called directly from code, but the attached patch would allow a plugin to
ensure it.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18713#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list