How to Remove URL Query Parameters in Wonder Lightbox

Plugin:

Wonder Lightbox, Version 10.8 or above

Tutorial:

In some situations, query string or query parameters are dynamically added to image or video URLs. When opening the image or video in the lightbox, you may want to remove the URL query string.

To remove the query string from the URL, go to your WordPress dashboard and navigate to the left menu: Wonder Lightbox -> Lightbox Options. Then, in the Advanced Options tab, add the following code to the Data Options input box:

data-removequerystring="true"

If you'd like to do more than simply remove the query string, you can use your own JavaScript function to pre-process the URL. In that case, add the following code to the Data Options input box:

data-filterurl="myURLFilter"

myURLFilter is the name of your custom JavaScript filter function. It needs to be defined as a global function and bound to the window object. For example, you can define it in the Custom JavaScript input box under the Lightbox Options tab:

function myURLFilter(href)
{
  return href.split("?")[0];
}