Displaying achor tag in error message

im trying to display custom error message in media library in wordpress, when the condition does meet error message is displayed with custom message that includes link but when i insert anchor tag in error message its displaying as plain text rather then html anchor tag.

hereadd_filter('wp_handle_upload_prefilter','mdu_validate_image_size');
function mdu_validate_image_size( $file ) {
    $limit = 500;

    $first_message = "click on link for the error information <a href='https://example.com' target='_blank'>Click here for more information</a>";
    
        // Define an array of allowed HTML tags
        $allowed_tags = array(
          'a' => array(
              'href' => array(),
              'target' => array(),
          ),
          'br' => array(),
          'p' => array(),
        );
 
    $is_image = strpos($file['type'], 'image');
 
    if ( ( $image_size > $limit ) && ($is_image !== false) ) {
        
        $file['error'] = wp_kses($first_message, $allowed_tags);
        return $file;
    }
   
    else
        return $file;
}

As you can see that in error message its displaying as plain text.


i want achor tag to be clickable

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.