Documentation > Developers > Filter Examples > Custom Selection Options Messages

Custom Selection Options Messages

function my_custom_selection_options_message( $message, $restriction, $from, $to ) {

	if ( 'exactly' == $restriction ) {
		$message = sprintf( 'You have to select exactly %s image(s).', $from );
	}
	elseif ( 'at least' == $restriction ) {
		$message = sprintf( 'You have to select at least %s image(s).', $from );
	}
	elseif ( 'a maximum of' == $restriction ) {
		$message = sprintf( 'You are only allowed to select a maximum of %s image(s).', $from );
	}
	elseif ( 'in the range of' == $restriction ) {
		$message = sprintf( 'You have to select between %s and %s images.', $from,  $to );
	}
	
	return $message;
}

add_filter( 'picu_selection_options_info_message', 'my_custom_selection_options_message', 10, 4 );Code language: PHP (php)

Need help?

If you couldn’t find what you were looking for and need more assistance, please get in touch with us directly and we’re happy to help.