Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
function publish_to_hub($post_id) {
// we want to notify the hub for every feed
$feed_urls = array();
$feed_urls = apply_filters('push_feed_urls', $feed_urls); // <-- a filter to add some more feeds
$feed_urls[] = get_bloginfo('atom_url');
$feed_urls[] = get_bloginfo('rss_url');
$feed_urls[] = get_bloginfo('rdf_url');
$feed_urls[] = get_bloginfo('rss2_url');
// remove dups (ie. they all point to feedburner)
$feed_urls = array_unique($feed_urls);
// get the list of hubs
$hub_urls = get_pubsub_endpoints();
// loop through each hub
foreach ($hub_urls as $hub_url) {
$p = new Publisher($hub_url);
// publish the update to each hub
if (!$p->publish_update($feed_urls, "http_post_wp")) {
// TODO: add better error handling here
return $post_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.