Support » Plugin: WP Video Popup – WordPress Video Lightbox for YouTube & Vimeo » I don’t really understand the filter Code

  • Resolved charledeon


    Beautiful day to you Sir,
    In your Introductory or Description Page, you mentioned something about filter and left this code:
    function prefix_your_custom_embed_url_attributes( $video_url ) {
    $video_url .= ‘&modestbranding=1’;
    return $video_url;
    add_filter( ‘wp_video_popup’, ‘prefix_your_custom_embed_url_attributes’ );

    Truth is that I am using a Child Theme, I don’t know PHP and Javascript, but I’m not afraid to go into functions.php, Style.CSS and Additional CSS to add code to my website.

    The issue is that I’m looking at this code, and don’t really know what I expect it to do for me, nor do I know if there’s anything in it that I need to change to reflect my own preference.

    Can you Please explain every part of this code to me? And also explain what it would actually help me do?

    Waiting to hear from you soon.

Viewing 1 replies (of 1 total)
  • Plugin Author David Vongries


    Hi @charledeon,

    the filter is pretty straightforward. Let’s break it down.

    By default, the plugin creates an embed-URL based on the URL you provide in the shortcode. For instance, if your shortcode looks like this:

    [wp-video-popup video=""]

    the embed-URL that the plugin creates and uses to display the iframe will look like this:

    By default, we add the autoplay parameter to the dynamically generated embed-URL but the filter allows you to add any other parameters to that URL.

    In the example from the docs we add the modestbranding parameter to the embed-URL.

    The filter basically allows you to add something to the end of the dynamically generated embed-URL which in this case can be used to add your own parameters.

    Here’s a list of parameters that are available for YouTube:

    Hope that helps! πŸ™‚


Viewing 1 replies (of 1 total)
  • The topic ‘I don’t really understand the filter Code’ is closed to new replies.