WordPress.org

Make WordPress Core

Ticket #18952: idn-ajax-workaround.php

File idn-ajax-workaround.php, 499 bytes (added by SergeyBiryukov, 3 years ago)
Line 
1<?php
2/*
3Plugin Name: IDN AJAX Workaround
4Version: 0.1
5Plugin URI: http://core.trac.wordpress.org/ticket/18952
6Description: Fixes AJAX requests on sites with IDN domains in IE and Opera.
7Author: Sergey Biryukov
8Author URI: http://profiles.wordpress.org/sergeybiryukov/
9*/
10
11function iaw_replace_domain($url) {
12        if ( false !== strpos( $url, 'admin-ajax.php' ) )
13                $url = preg_replace( '#^http(s)?://[^/]*#', '', $url );
14        return $url;
15}
16add_filter('admin_url', 'iaw_replace_domain');
17?>