Hi all,
I want the user to select a category before posting new post. if he\she doesn't select an category, he cant post the new post.
It means that category of a post is must.
Please me on this..
thank you.
Hi all,
I want the user to select a category before posting new post. if he\she doesn't select an category, he cant post the new post.
It means that category of a post is must.
Please me on this..
thank you.
Have you heard back or discovered an answer for this? I want to do the same thing.
I had to hack this client-side:
jQuery( document ).ready( function($) {
if ( $( ".post-new-php form#post" ).length || $( ".post-php form#post" ).length ) {
$( "form#post" ).submit( function() {
if ( $( "ul.categorychecklist input:checked" ).length == 0 ) {
alert( "Please select a category for this post!" );
return false;
}
});
}
}
I've just added this to my custom theme's admin JS file. If you need to add this to a custom theme, if the above code is in your theme in a file called "admin.js", use this code to include it:
function admin_js() { ?>
<script type="text/javascript" src="<?php echo trailingslashit( get_bloginfo( 'template_directory' ) ); ?>admin.js"></script>
<?php }
add_action( 'admin_footer', 'admin_js' );
It could be easily wrapped up in a tiny plugin of course.
I'd be interested if anyone finds a server-side method.
This topic has been closed to new replies.