Skip to main content
Share Your Experience: Take the 2024 Developer Survey
5 votes
Accepted

How to Replace the WordPress Featured Image with a Video?

Let's say for simplicity that you're using ACF. You need to create a video link field once ACF is installed and assign it to posts. Then, in the post you want a video to show up, add the url. I ...
rudtek's user avatar
  • 6,121
4 votes

Vimeo videos not working

After further investigation this appears to be Vimeo blocking the requests. We have two sites (one where Vimeo videos work and one where they don't). When testing the retrieval of content via PHP we ...
Chris's user avatar
  • 161
4 votes
Accepted

Fullscreen Video/GIF Intro

The following code uses HTML5 Video, with the muted & autoplay attributes set. It takes the video, which I uploaded through the media gallery and displays it fullscreen. I'm using a script that ...
RiddleMeThis's user avatar
  • 3,767
3 votes
Accepted

How to check If Oembed is empty or not

The wp_oembed_get() only works for supported oEmbed providers. The return value is also is a URL of false, as mentioned per codex: If $url is a valid url to a supported provider, the function ...
Johansson's user avatar
  • 15.3k
3 votes

Video shortcode - autoplay all videos

I ran into this problem while trying to make HTML videos behave like GIFs. WordPress's built-in video player uses HTML video elements but does not allow videos to play simultaneously. Instead of ...
Peter Moran's user avatar
3 votes

How can I create a custom meta box to add an mp4 video to a page?

You were close. This is similar to something I'd done recently. Here is a rewrite of your code that is working. In addition I've changed the word "image" to "video" throughout the function so that it ...
Storio digital's user avatar
2 votes
Accepted

How can I get the [video] shortcode to allow query string parameters?

You got two options. Either you filter your valid video extentions as @birgire recommended. I remember a similar issue for the audio shortcode here. There I found a workaround by allowing the ...
iantsch's user avatar
  • 804
2 votes

How can I get the [video] shortcode to allow query string parameters?

I remember a similar issue for the audio shortcode here. There I found a workaround by allowing the empty audio extension. You could try something similar with the video extensions. Here's a demo ...
birgire's user avatar
  • 67.4k
2 votes
Accepted

Query posts that contain video?

I don't think there's a fool-proofed way to do that, because the YouTube videos can be embedded in various ways and later be removed from the posts' content. Here are few ideas: If you mean ...
birgire's user avatar
  • 67.4k
2 votes

How can I use a video header that's over 8MB?

The limit is enforced by _validate_header_video method, registered as validation callback on respective Customizer setting. There is a filter that allows you to hook into the process and manipulate ...
Rarst's user avatar
  • 99.7k
2 votes
Accepted

WP REST - video and audio players

Ran into this same issue and I found the answer after many hours and almost giving up. It's in a bit of code that written to make the Customizer work with playlists. Checkout this comment from /wp-...
squarecandy's user avatar
2 votes
Accepted

Adding a video description in a similar way to a image caption

It will be interesting to see how the new evolving WP Gutenberg editor will handle shortcodes and embeds. If you use the [embed] shortcode for embedding, then a semi workaround, without UI support: ...
birgire's user avatar
  • 67.4k
2 votes

Upload restrictions - upload_mimes - filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?

This filter only accepts strings for mime types. It also already has support for webm, mp4, mpeg, ogv, and ogg. I think you can remove everything except the line for SVGs. A word of warning, ...
MikeNGarrett's user avatar
  • 2,661
2 votes
Accepted

Adding video to a Wordpress website

So, I don't know what kind of videos you are including that would break the rules of these websites (especially Vimeo, I think they are pretty lenient on what you can upload there) but in general, I ...
WSU's user avatar
  • 241
1 vote

Display custom post type attached media file sizes

From your array, you should get the Media ID of the videos. If you have the media ID, it will be as listed below: // Let's say you have the media ID $meta = filesize( get_attached_file( $attachment_id ...
Cristian Stan's user avatar
1 vote

Let users sell video in my website

If you have an education website LearnDash could be a good choice. It's a good plugin but doesn't include a free version. Users can register as teacher and sell their courses. Other option could be ...
mahdi azarm's user avatar
1 vote

How to change the settings of a video?

My coding skills are very minimal, and I can't seem to find & edit the HTML. This is because video embeds are usually implemented using a shortcode, there is no HTML to edit, it's generated on ...
Tom J Nowell's user avatar
  • 59.4k
1 vote
Accepted

Upload restrictions - upload_mimes - filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?

@MikeNGarret's answer pointed me to the interesting function wp_get_mime_types(). Within this function you can look up how to correctly add MIME types to the upload_mimes filter (https://core.trac....
Blackbam's user avatar
  • 545
1 vote

Remove Custom Divs from AMP pages

Sometimes you want to delete not the html code but shortcode. Then use something like that: add_action( 'pre_amp_render_post', 'amp_vid_rmv' ); function amp_vid_rmv() { add_filter( 'the_content', '...
Serhii Kushchenko's user avatar
1 vote

Remove Custom Divs from AMP pages

Thanks to Thomas' answer to my question at StackOverflow - https://stackoverflow.com/questions/53158606/remove-div-with-a-class-without-removing-content Here's how you can do it on Wordpress for AMP. ...
user1928108's user avatar
1 vote

How to check If Oembed is empty or not

It’s a little hard to guess what’s your question really is and what exactly you want to check... If you want to check if $embed is empty, just check it: if ( ! trim($embed) ) { // it’s empty } ...
Krzysiek Dróżdż's user avatar
1 vote
Accepted

how to use preg_replace for wordpress video?

So you're using the default WordPress video shortcode in the editor, right? If so, there's no need to filter the whole content, especially that markup for the video would be already rendered and is ...
Levi Dulstein's user avatar
1 vote
Accepted

Strange video appears in background on Safari only

There is only one video file on your page: http://popplekharlamova.com/wp-content/uploads/2016/09/PK_VIDEO.mp4. It is being loaded on all browsers. It's hidden in this CSS-block as a background-image:...
Armin Šupuk's user avatar
1 vote
Accepted

Can't get video meta from wp_read_video_metadata()

To make sure you're getting the correct path to the video, pass the ID to get_attached_file(), and use that in wp_read_video_metadata(). wp_upload_dir() is for getting/creating a directory to write to ...
Jacob Peattie's user avatar
1 vote

How to Replace the WordPress Featured Image with a Video?

I think you should give a try to this plugin : https://wordpress.org/plugins/featured-video-plus/ If you don't like to use extra plugin then you should definitely look into their code for reference. ...
Milan Bastola's user avatar
1 vote
Accepted

Video header on mobile, disappears behind header and content

You can target those devices using css, and put a declaration specifically for that. Add this to your css file, and adjust to the suitable value: @media screen and (max-width: 768px) { .page-...
Samuel Asor's user avatar
1 vote

Resizing built-in wordpress video not working!

Try to place this in your style.css embed, iframe, object, video { margin-bottom: 1.6em; max-width: 100%; vertical-align: middle; }
Shivanand Sharma's user avatar
1 vote

Video Shortcodes not working in Wordpress

According to WordPress codex here https://codex.wordpress.org/Video_Shortcode . You wrote the shortcode wrong, you added mp4 instead of src The correct way to write the shortcode Is like this: [...
frenchy black's user avatar
1 vote
Accepted

Add div on EMED Tag

you can use 'embed_oembed_html' to wrap that iframe inside the div. add_filter('embed_oembed_html', 'Oembed_youtube_no_title', 99, 4); function Oembed_youtube_no_title($html, $url, $attr, $post_id) {...
GKS's user avatar
  • 1,306

Only top scored, non community-wiki answers of a minimum length are eligible