Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Remove Required Comment Textarea (Repost)

Discussion in 'Misc WordPress Requests' started by Dipak C. Gajjar, Jan 21, 2018.

  1. Dipak C. Gajjar

    Guest

    Reply To: Remove Required Comment Textarea (Repost), by Dipak C. Gajjar

    First, please mark the thread as Resolved as the original question is answered (and worked for you) already.

    The correct pattern to validate youtube URL is:

    ^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$

    Hence, you can do something like…

    $comments_args = array(
    // redefine your own textarea (the comment body)
    'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Video URL', 'noun' ) . '</label>
    <input type="url" id="comment" name="comment" placeholder="https://youtu.be/example" pattern="^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$" required aria-required="true"></input></p>',
    );

    comment_form( $comments_args );

    Reply To: Remove Required Comment Textarea (Repost)
     
    #1

Share This Page

Monarch Social Sharing Plugin