Skip to content

Instantly share code, notes, and snippets.

@mAAdhaTTah
Created September 27, 2015 05:55
Show Gist options
  • Save mAAdhaTTah/ed7e1c5548be35e7b091 to your computer and use it in GitHub Desktop.
Save mAAdhaTTah/ed7e1c5548be35e7b091 to your computer and use it in GitHub Desktop.
Facebook Post Debugger
<?php
/*
Plugin Name: Facebook Post Debugger
Version: 0.1
Plugin URI: http://jamesdigioia.com/
Description: This plugin runs the bit.ly shortlink through the Facebook debugger upon publishing.
Author: James DiGioia
Author URI: http://www.jamesdigioia.com/
*/
add_filter( 'publish_post', 'fb_debug_link' );
function fb_debug_link( $post ) {
$short = wp_get_shortlink($post['id']);
$url = 'https://graph.facebook.com/?id='.$short.'&scrape=true';
wp_remote_post( $url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment