I'm trying to embed a video file (from Media Library) in a comment.

Adding the default code currently used in Posts didn't work:

[video width="1280" height="718" mp4="https://www.example.com/wp-content/uploads/2021/10/video.mp4"][/video]

Pasting the raw link in the comment dind't work either, and the output was in plain text:

[video src="https://www.example.com/wp-content/uploads/2021/10/video.mp4" /]

Is there a way to make Wordpress parse the comments in a way that I can use either the video shortcode or the raw link? I'm asking for help because I don't want to use a plugin for this. Thanks.


1 Answer 1


Yea, you can't use short codes in comments by default with WordPress. Short codes are anything surrounded in those '[ ]' brackets. There are plugins you can install that allow you to use short-codes in posts, products, categories, and other places in WordPress that you aren't able to by default. However, I don't know of any that will allow you to put short-codes inside of comments fields since those fields are usually reserved for users to fill out.

There is a way to add your own PHP code to functions.php to add this ability as explained in this article: https://www.isitwp.com/add-shortcode-support-to-comments/

The other option would be to try using the HTML5 tag for videos, . Which would look something like:

<video controls width="250">
  <source src="/uploads/flower.webm" type="video/webm">
  <source src="/uploads/flower.mp4" type="video/mp4">
  <source src="/uploads/flower.ogg" type="video/ogg">

Although, with the tag option, you may run into compatibility issues with different browsers & Operating Systems. If you do decide to try this option, just make sure that you include a few different video formats like the 3 I included (mp4, webm, & ogg) to increase the chances the video will be compatible and viewable for most people.

  • Thanks a lot for this, it worked perfectly! I followed your link, then found out I can just enable all shortcdes in comments using this line: add_filter( 'comment_text', 'do_shortcode' ); Oct 17, 2021 at 20:03
  • Awesome! Glad to help! You definitely picked the better option in my opinion. It's hard to tell how comfortable people on these forums are with editing any of the PHP files since they can look pretty daunting if you don't have any experience with code. That's why I included the second part about the HTML5 <video> tag.
    – MKlodt
    Oct 18, 2021 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.