Title: Remove Query String
Last modified: July 23, 2024

---

# Remove Query String

 *  [heyjoecampbell](https://wordpress.org/support/users/heyjoecampbell/)
 * (@heyjoecampbell)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/remove-query-string-2/)
 * Please provide a code snippet to remove the query string added to each URL.
 * Consider adding a setting to disable the feature as some users do like plugins
   modifying urls.
 * Thanks 😀

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [WP Zone Support](https://wordpress.org/support/users/aspengrovesupport/)
 * (@aspengrovesupport)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/remove-query-string-2/#post-17934250)
 * Hello,
   Thanks for contacting us.Can you provide information on which query string
   you are referring to?
 *  Thread Starter [heyjoecampbell](https://wordpress.org/support/users/heyjoecampbell/)
 * (@heyjoecampbell)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/remove-query-string-2/#post-17935108)
 * The query string is appended to the images in the Media Library, here is a sample:
   ?
   _t=1722894832?_t=1722894964
 *  Plugin Author [WP Zone](https://wordpress.org/support/users/aspengrovestudios/)
 * (@aspengrovestudios)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/remove-query-string-2/#post-17941559)
 * Hi, this query parameter is added by default in the admin to help prevent caching
   from causing issues when an image is changed – without it, the image may not 
   switch to the new image for some time after the image is replaced.
 * It can be removed via the following (we’d suggest in the `admin_init` hook since
   only the admin should be affected by these hooks):
 * `remove_filter('wp_calculate_image_srcset', 'hm_replace_image_calculate_image_srcset');`
 * `remove_filter('wp_get_attachment_image_src', 'hm_replace_image_get_attachment_image_src');`
 * `remove_filter('wp_prepare_attachment_for_js', 'hm_replace_image_prepare_attachment_for_js');`
 * Is there a reason why you want to remove the query parameter? Is it causing problems?
 *  Thread Starter [heyjoecampbell](https://wordpress.org/support/users/heyjoecampbell/)
 * (@heyjoecampbell)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/remove-query-string-2/#post-17941646)
 * I sometime copy the image url from the Media Library for frontend usage.
 *  Thread Starter [heyjoecampbell](https://wordpress.org/support/users/heyjoecampbell/)
 * (@heyjoecampbell)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/remove-query-string-2/#post-17941647)
 * Thanks for providing the filters 👍🏽

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Remove Query String’ is closed to new replies.

 * ![](https://ps.w.org/replace-image/assets/icon-256x256.png?rev=3061293)
 * [Replace Image](https://wordpress.org/plugins/replace-image/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/replace-image/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/replace-image/)
 * [Active Topics](https://wordpress.org/support/plugin/replace-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/replace-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/replace-image/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [heyjoecampbell](https://wordpress.org/support/users/heyjoecampbell/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/remove-query-string-2/#post-17941647)
 * Status: not resolved