How do I remove specific videos from my gallery?

Vimeography provides a WordPress filter `vimeography.pro.localize` that allows you to act on the video data for your gallery before it is rendered on your website.

The filter receives two parameters

  1. `$data` – the data associated with the gallery, including its id, the current theme, theme version, video collection source, video set, and more.
  2. `$gallery_settings` – the settings associated with the current gallery, including if search is enabled, auto advance, etc. some of this information is duplicated from the $data parameter above.

You can use this filter to make modifications to your video data or remove specific videos from appearing in your gallery.

This code should be added to your WordPress theme's functions.php file. Alternatively, you can add this code to your site using another plugin called Code Snippets.

Removing video with id of `12345678`

    add_filter('vimeography.pro.localize', function($data) {

      foreach ( $data['video_set'] as $id => $video ) {
        if ($id === 12345678) {
          unset($data['video_set'][$id]);
        }
      }
      
      return $data;
    });

Removing all videos with privacy setting "People with the private link"

    add_filter('vimeography.pro.localize', function($data) {

      foreach ( $data['video_set'] as $id => $video ) {
        if ($video->->privacy->view === "unlisted") {
          unset($data['video_set'][$id]);
        }
      }
      
      return $data;
    });

Still need help? Contact Us Contact Us