表单中需要的Wordpress文本编辑器字段


Wordpress text editor field required in form

请帮助我通过JavaScript或任何HTML的东西修复以下文本编辑器的形式与条件所需的功能。

我在前端使用wp编辑器字段上传求职者简历。但我希望这个字段需要(*),所以表格不会提交,直到这个表格空白。

$editor_id = 'resume_content';    
$editor_css = '
<style>
    .wp-editor-container{
        border: 1px solid #e5e5e5;
        -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
        box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    }
    .wp-switch-editor,
    .tmce-active .switch-tmce, .html-active .switch-html{
        height:25px;
    }
</style>';
wp_editor( $default['resume_content'], $editor_id, array( 'editor_class' => 'form-control', 'media_buttons' => false, 'editor_css' => $editor_css,  ) );

请使用

<?php wp_editor( $listing->post_content, 'listingeditor', $settings = array('textarea_name' => post_content) ); ?>

您可以使用过滤器函数:

add_filter("the_editor", "add_required");
function add_required($editor){
  $editor =  str_replace( '<textarea', '<textarea required="required"', $editor );
  return $editor;
}