, and HTML tags, allowing the tags in * the final result. * * @param string $text - The string we need to sanitize. * @return string */ public static function sanitizeTextWithFormattingTags($text) { $allowedTags = [ 'strong' => [], 'em' => [], 'del' => [], ]; return \wp_kses($text, $allowedTags); } /** * This function will sanitize a textarea field. * * @param string $text - The strings we need to sanitize. * @return string */ public static function sanitizeTextarea($text) { return \sanitize_textarea_field($text); } /** * This function will sanitize a gutenberg block. * * @param string $blockString - The strings we need to sanitize. * @return string */ public static function sanitizeBlocks($blockString) { $parsed = parse_blocks($blockString); return \serialize_blocks($parsed); } /** * This function will sanitize the post content. * * @param string $content - The post content we need to sanitize. * @return string */ public static function sanitizePostContent($content) { return \wp_kses_post($content ? $content : ''); } }