Title: URL Encoding Bug
Last modified: August 22, 2016

---

# URL Encoding Bug

 *  Resolved [Andy Stratton](https://wordpress.org/support/users/theandystratton/)
 * (@theandystratton)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/url-encoding-bug/)
 * When more than one query var is in the admin URL, clicking Sort By Order double
   encodes some ampersands, it seems to be due to the plugin calling `url_encode()`
   then `add_query_arg()` also calling `url_encode()` to the second argument.
 * simple-page-ordering.php, line 286 can go from:
 * `$query_string = add_query_arg( 'orderby', urlencode( 'menu_order title' ), $
   query_string );`
 * to:
 * `$query_string = add_query_arg( 'orderby', 'menu_order title', $query_string );`
 * I noticed this when sorting by published or by a taxonomy then attempting to 
   Sort By Order.
 * [https://wordpress.org/plugins/simple-page-ordering/](https://wordpress.org/plugins/simple-page-ordering/)

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

 *  Plugin Contributor [Jake Goldman](https://wordpress.org/support/users/jakemgold/)
 * (@jakemgold)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/url-encoding-bug/#post-5725360)
 * Fixed. Good find!
 *  [IanRr](https://wordpress.org/support/users/ianrr/)
 * (@ianrr)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/url-encoding-bug/#post-5725402)
 * I’m up-to-date but I still have this issue. I feel like the onus is a little 
   more on WP than on SPO, but the only way I was able to resolve it was by removing
   the esc_url() from the function you changed, so:
 * `$query_string = esc_url( remove_query_arg( array( 'orderby', 'order' ) ) );`
   becomes `$query_string = remove_query_arg( array( 'orderby', 'order' ) );`
 * There’s a whole bunch of escaping happening in the WP core, and I haven’t run
   into any issues from removing this. But I don’t know if it’s something that *
   everyone* would want to do — just a heads up for anybody dealing with this.

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

The topic ‘URL Encoding Bug’ is closed to new replies.

 * ![](https://ps.w.org/simple-page-ordering/assets/icon-256x256.png?rev=2716033)
 * [Simple Page Ordering](https://wordpress.org/plugins/simple-page-ordering/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-page-ordering/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-page-ordering/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-page-ordering/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-page-ordering/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-page-ordering/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [IanRr](https://wordpress.org/support/users/ianrr/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/url-encoding-bug/#post-5725402)
 * Status: resolved