Skip to content

Instantly share code, notes, and snippets.

@romulodl
Created November 9, 2011 02:41
Show Gist options
  • Save romulodl/1350160 to your computer and use it in GitHub Desktop.
Save romulodl/1350160 to your computer and use it in GitHub Desktop.
Wordpress workaround to Facebook's like button bug (?fb_xd_fragment=$)
<?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();
}
}
}
@rslonik
Copy link

rslonik commented Nov 9, 2011

URL do autor está errado :(

Tem que ser .com.br

@romulodl
Copy link
Author

romulodl commented Nov 9, 2011

changed =D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment