Skip Navigation

[Resolved] What is the slug for a featured image?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)


I am following this post but it asks me to replace with the slug of my featured image. I am using just the custom default WordPress featured image field. What do I need to put into the snippet of code used here:



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

That's an old thread, and some of the information is outdated, in particular the details relating to ajax updates to pre-load images. That is now handled via the WordPress media uploader, if chosen in the form settings, and only the non-ajax method (the images are uploaded along with the form submission) is amenable to validation using the suggested code.

In that forum thread there are two code suggestions, and it is the first of the two that you would need to use (which uses the cred_form_validate hook). And looking at the code, it appears it already targets the featured image field (rather than a custom image field).

Did you try that code?


I just tested it again and the form uploads images outside of the parameters set. hidden link



Thank you for sharing this update.

I can perform some tests on my website and suggest adjustments to that code. But, first I'll need to see how this form and its fields are set up in the admin area.

Please share the temporary admin login details in reply to this message.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.



Thank you for sharing the access details.

I've performed some testing and research with a similar form on my website and here are the findings:

The filter 'cred_form_ajax_upload_validate' (that the code from the referenced ticket is using), specifically targets the event when a new image is uploaded into the WordPress media library through Toolset Forms.

For this filter to trigger, the following conditions need to be met:

1. In the form's settings, the 'Use the WordPress Media Library manager for image, video, audio, or file fields' option needs to be checked.


2. The new image should be uploaded as it won't fire if an existing image from the media library is selected.


3. The visitor who is submitting the form, needs to be logged in as a user. For guests (non-logged-in), this filter won't be triggered because the guests can't upload images into the media library and a standard image upload field is shown when they are submitting the form.

So, if you need to target the featured image field in a more generic way, you can switch to the 'cred_form_validate' hook, instead:
( ref: )


function my_validation($error_fields, $form_data)
	//field data are field values and errors
	//validate if specific form 
	if ( ($form_data['id']==356) ) {
		if(!empty($fields['_featured_image']['file_data'])) {
			list($width, $height, $type, $attr) = getimagesize($fields['_featured_image']['file_data']['tmp_name']);   
			if ($width != 500 && $height != 500) {
				//set error message for featured image
				$errors['_featured_image'] = 'Image size must be 500 * 500, your image dimensions are '.$width.' * '.$height;
	//return result
	return array($fields,$errors);

This should do the trick.


Thank you!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.