WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am setting up a Wordpress site as a CMS and trying to figure out a way to make certain post fields "required" before an author can publish a post.

In particular, I want authors to be required to select a "category" and to set a "featured image". It's been suggested that something like this could be done using some Javascript, but to be honest, I'm not entirely sure where to start (and my Javascript skills aren't the best).

If anyone has an idea as to how this can be done, I can really use the help. Thanks!

share|improve this question
With categories, one might like to insist on 2 or any other number of categories, or one subcategory from any number of parent categories. – Simon Gibbs Oct 14 '12 at 13:09

Fairly simple using jQuery and global $typenow ex:

add_action('admin_print_scripts-post.php', 'my_publish_admin_hook');
add_action('admin_print_scripts-post-new.php', 'my_publish_admin_hook');
function my_publish_admin_hook(){
    global $typenow;
    if (in_array($typenow, array('post','page','mm_photo '))){
        <script language="javascript" type="text/javascript">
            jQuery(document).ready(function() {
                jQuery('#post').submit(function() {
                    if (jQuery("#set-post-thumbnail").find('img').size() > 0) {
                        return true;
                        alert("please set a featured image!!!");
                        return false;
                    return false;

share|improve this answer

I've been looking for a suitable solution for this as well. I came across this plugin which will make certain fields mandatory before a post can be published.


The plugin author has said that: "In the next version of this plugin we plan to mandate 'Featured Image' field before posting."

It has not been updated since July 2011, but there might still be some hope for it :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.