Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » disable responsive videos

  • Resolved SaladGoat

    (@saladgoat)


    I want to turn OFF Jetpack’s responsive video thing, but there doesn’t seem to be a switch for it. Searching Jetpack, tells me about an “option” but that page only shows me a bunch of code to add to functions.php to ADD the feature. But I never added that code to my functions.php – it’s not there, yet Jetpack is still doing its thing. So how do I turn it off?
    Google returned some seemingly complicated code that removes it, but it was talking about block names and I have no idea what that’s about. Is it asking me to specify each instance I want to remove? I want it completely turned off, not selectively but universally.
    Seems to me there should be a switch in Settings, instead of having to hack it with code in functions.php, but if that’s what it takes, bring it on.
    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Dat Hoang

    (@htdat)

    Hello,

    I want to turn OFF Jetpack’s responsive video thing, but there doesn’t seem to be a switch for it.

    We’re not sure if this is a Jetpack feature or not. Can you please take some screenshots for us to show this? You can use this free app https://snipboard.io/

    Searching Jetpack, tells me about an “option” but that page only shows me a bunch of code to add to functions.php to ADD the feature. But I never added that code to my functions.php – it’s not there, yet Jetpack is still doing its thing. So how do I turn it off?
    Google returned some seemingly complicated code that removes it, but it was talking about block names and I have no idea what that’s about. Is it asking me to specify each instance I want to remove? I want it completely turned off, not selectively but universally.

    Where did you find these custom codes? Can you please share these links so we can understand what you’re trying to achieve.

    Thread Starter SaladGoat

    (@saladgoat)

    You’re Jetpack support and you don’t know if it’s a feature or not? Well, hopefully the following requested info will help you figure it out….

    What I found in my Page Source (screenshot): https://snipboard.io/PQ6ojp.jpg

    Jetpack’s code to add to functions.php (which I did not add and does not exist in my functions.php):
    https://jetpack.com/support/responsive-videos/

    Some other site’s code to remove the option (complicated code):
    https://jetpack.wp-a2z.org/oik_api/jetpack_responsive_videos_remove_wrap_oembed/

    Plugin Contributor Ryan C.

    (@ryancowles)

    You’re Jetpack support and you don’t know if it’s a feature or not? Well, hopefully the following requested info will help you figure it out….

    Thanks for the additional information. Based on the initial post, we weren’t 100% sure if this issue was related to Jetpack’s Responsive Videos feature. We just wanted to make sure we understood the issue before diving in.

    What I found in my Page Source (screenshot): https://snipboard.io/PQ6ojp.jpg

    Can you provide us with a link to this page? Alternatively, can you temporarily change to a different theme and see if the issue persists? That will allow us to determine if this issue is related to a specific theme or not.

    Please let us know how that works for you and we can go from there!

    Thread Starter SaladGoat

    (@saladgoat)

    Speaking of themes made me go digging deeper.

    In the parent theme’s functions.php is this line:
    require get_template_directory() . '/inc/jetpack.php';

    Following that, I find this line in that file:
    add_theme_support( 'jetpack-responsive-videos' );

    Now, I can’t just delete that, since it’s in the parent theme, so how do I reverse it in my child theme? Is it simply a matter of adding
    remove_theme_support( 'jetpack-responsive-videos' );
    in my functions.php? Or is there more to it than that?

    Thanks!

    Plugin Contributor Jen H.

    (@jenhooks)

    Hey @saladgoat,

    You could use a plugin like Code Snippets to add some code to your site, using remove_theme_support instead of add_theme_support.

    An even better option would be to use a filter:

    
    add_filter( 'jetpack_tools_to_include', function( $tools ) {
        $index = array_search( 'theme-tools/responsive-videos.php', $tools );
        if ( $index ) {
            unset( $tools[$index] );
        }
        return $tools;
    } );
    
    • This reply was modified 10 months, 1 week ago by Jen H..
    • This reply was modified 10 months, 1 week ago by Jen H..
    • This reply was modified 10 months, 1 week ago by Jen H..
    • This reply was modified 10 months, 1 week ago by Jen H..
    Thread Starter SaladGoat

    (@saladgoat)

    Hi Jen, thanks for the pointers.

    I don’t really understand the point of Code Snippets – just keep your stuff there instead of in functions.php? Why not just put it in functions.php?

    I tried that code you provided but it did not work – in functions.php. But I put it in Code Snippets and it worked!

    So now I’m really confused!

    Tracy

    (@tmmbecker)

    Glad to hear that worked!

    I don’t really understand the point of Code Snippets – just keep your stuff there instead of in functions.php? Why not just put it in functions.php?

    It’s never a great idea to add custom functions and filters to your functions.php file. When the theme is updated, the functions.php file may be updated as well (and often is). In that case, you’d lose any customizations that you’d added.

    Using a functionality plugin allows you to add customizations without worrying about any changes to the functions.php file. You can even update your theme and keep customizations like this in place.

    Depending on how and where you’d added that code to the functions.php file, it may have prevented the filter from running at the right time. You should be able to add the snippet to the bottom of the functions.php file and get the same outcome that you get with Code Snippets.

    • This reply was modified 10 months ago by Tracy.
    Thread Starter SaladGoat

    (@saladgoat)

    I use a child theme, so no worries about overwriting the functions.php file when updating the parent theme. And I did put that code at the bottom of the functions.php.

    Everything else in the child functions file works. And I’m assuming Code Snippets just appends the code to the end of that file anyway, right? So it’s exactly the same … yet the code in functions.php doesn’t work but the exact same code works when switched on in Code Snippets.

    Why would that be?

    Plugin Support Dat Hoang

    (@htdat)

    Hello,

    And I’m assuming Code Snippets just appends the code to the end of that file anyway, right?

    Most of the snippets added in functions.php files can work but that’s not true for all snippets. Technically, this is not true.

    The main reason is about how WordPress loads its core files, then plugins, and themes (including functions.php). You can see this great article https://www.wpbeginner.com/wp-tutorials/how-wordpress-actually-works-behind-the-scenes-infographic/:

    11. Load Active Plugins
    17. Load Child Theme’s functions.php File
    18. Load Parent Theme’s functions.php File

    In summary, “Code Snippets” is loaded earlier than functions.php files are. Therefore, this fact does matter sometimes.

    We hope that clarifies your concern.

    That said, we’re not going to troubleshoot why a specific snippet works with Code Snippets while it’s not working with functions.php. As it’s not what we provide support here.

    I am marking this as resolved as the snippet is working with Code Snippets plugin. Please start a new thread if you have any other issues with Jetpack.
    https://wordpress.org/support/plugin/jetpack#new-post

    Thread Starter SaladGoat

    (@saladgoat)

    I disagree that this problem is resolved.

    Your plugin requires another plugin to turn off something that should be optional.

    Seems like an easy fix: add a switch that I can turn it off with.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘disable responsive videos’ is closed to new replies.