You can display videos and images in WordPress, and there are many good reasons to do so. First of all, they make your website more interesting and engaging. They also enhance SEO by attracting and retaining visitors. In this post, I share my recommended methods for displaying videos in WordPress.
Self-hosted videos are those that you upload to your site. By default, WordPress allows many video formats to be uploaded to the media library. This approach is not always possible, though. Depending on your web host and hosting plan (especially with shared hosting), there may be file size and space limitations. Since videos can be quite large, space on your shared hosting server can be used up pretty quickly when uploading to the media library. In addition, videos require optimized speed, plenty of RAM, and sufficient bandwidth.
While shared hosting usually doesn’t meet all of these needs, VPS and Dedicated Hosting plans may provide an adequate environment for self-hosted video. Check your hosting plan to make an informed decision. If you’ve determined that it’s OK to upload the video file, use the steps below as a guide.
1. Upload to Media Library
You could upload the video to your media library, then insert it into a page or post at a later time. Or, you could upload and insert at the same time. Let’s look at the steps for uploading.
- Go to the Media Library
- Click the “Add New” button. Alternatively, click on “Add New” in the left sidebar underneath the “Media” label.
- You have the choice of dragging and dropping the video file into the upload box, or clicking the “Select Files” button to find and select the file on your computer.
2. Display a Video in a Page or Post
- Add a Video block
(option 1): click on Plus “+” sign in next paragraph section
(option 2): click on Plus “+” sign in upper left corner of editor window
With both options, a list of blocks will appear. You’ll get a more extensive list with option 2. In the search bar, you can type “video” to quickly find and select the block.
- Use the Video block to upload a new video or select one that’s already in the media library.
NOTE: the third option (“insert from URL”) will be discussed in the next section on Hosted Videos.
Hosted videos are stored on another site and a link or embed code is used to display them on your site. The video streams from the video host’s server, rather than your own webhost’s server. This is my preferred method.
1. Upload Video to Third-Party Host
- Upload your video file to a well-known, reliable hosting service like YouTube, Vimeo, or Wistia.
- Copy the URL address or click the “Share” link.
2. Display a Video in a Page or Post
Embed the Video
Paste the URL or “Share” link into a WordPress block. Seamlessly, the generic block changes to the appropriate video host block. The WordPress built-in video player automatically detects the host’s settings, the user’s device, browser, and internet connection. The video will appear and can be played directly on WordPress. The user will also have the option of going to the host site and viewing it there.
- ALTERNATIVE: Add a Video Block
Similar to what we did in the self-hosted section above, you could use an actual Video block. Click on Plus “+” sign in next paragraph section or in the upper left corner of editor window. Select the “Video” block.
– Use the Video block to “insert from URL”. Paste the URL into the field provided and click on the reverse arrow to apply.
– Vimeo and YouTube have their own blocks that you could use instead of the generic Video block.
- ALTERNATIVE: Use iFrame and Custom HTML Block
Instead of copying the URL from a video host site, you could use the iFrame code in a Custom HTML block. WordPress allows automatic video embeds from a limited number of sites. So, if your video is hosted on a server not on their list, you can go with this alternative method.
I’ll use YouTube as an example, even though it is on the WordPress auto-embed list. You click the “Share” link, then select the “Embed” option. A pop-up window will appear where you can copy the iFrame code. You paste the iFrame code into a Custom HTML block.
Although iFrames do have their purpose, I recommend using them as a last resort. Some important reasons for avoiding them:
- SEO – Search engines may have difficulty indexing and ranking pages with iFrames
- Linking – Users cannot link to iFrame content
- Stability – iFrames behave erratically on different browsers
- Security – Malicious code injection is a possibility
- ALTERNATIVE: Plugins
There are lots of plugins to choose from. In all of my years using WordPress, I think I’ve used a video plugin only once. That was so many years ago that I don’t even remember which plugin! If you use a video plugin, please share! Tell us which one and if you’d recommend it.