Make Image Compulsory

  • Author
  • geokip

    Greetings, many thanks for this theme and plugins. They are beyond amazing. I have a question or two… How do I go about making images compulsory? They are currently set to optional. And can someone limit/increase the number and size of images to be uploaded?


    Thanks! If you have a moment, please rate it on, it really helps to continue the development

    You can use this code snippet to require uploading at least 1 image, and change the maximum number of images that can be uploaded:

    	function( $model ) {
    		$model['fields']['images']['required']  = true;
    		$model['fields']['images']['max_files'] = 10;
    		return $model;

    Thank you for the feedback. I added the code but when I tried it out, the form just kept reloading. It did not give any alert/error whatsoever.


    Is it the ‘image’ field or the ‘images’ field that should be made compulsory? Because if I tweak the above code and change the $model[‘fields’][‘images’][‘required’] = true; to $model[‘fields’][‘image’][‘required’] = true; the code seems to work. The downside is that the label field for images is still saying (optional). So that might confuse a user 🙁


    There’s a new version of HivePress, please try updating and check if the above snippet works (I tested and fixed it while developing the latest version).


    I just wanted to say I tried the code with the latest theme version and it worked for me – thanks very much!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.


Sign In

Don't have an account? Register

Forgot password?


Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.