Created
November 9, 2011 02:41
-
-
Save romulodl/1350160 to your computer and use it in GitHub Desktop.
Wordpress workaround to Facebook's like button bug (?fb_xd_fragment=$)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Caralho! | |
* @version 1.6 | |
*/ | |
/* | |
Plugin Name: CARALHO | |
Plugin URI: http://pudim.com.br | |
Description: (CARALHO == portuguese of FUCK). If you are getting a blank page because of the "?fb_xd_fragment=$" in your URI, this plugin could be your solution! | |
Author: CARALHO! | |
Version: 0.1 | |
Author URI: http://pudim.com.br | |
*/ | |
new Caralho; | |
class Caralho{ | |
public function __construct(){ | |
add_action('template_redirect', array($this, 'puta_merda')); | |
} | |
public function puta_merda(){ | |
if(strpos($_SERVER['REQUEST_URI'], '?fb_xd_fragment=')){ | |
$url = get_bloginfo('wpurl') . preg_replace("/(.*)\?fb_xd_fragment=$/", '$1', $_SERVER['REQUEST_URI']); | |
header("Location: " . $url); | |
header("HTTP/1.1 302 Temporary Redirect"); | |
exit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
URL do autor está errado :(
Tem que ser .com.br