Guest User

Untitled

a guest
Jun 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2. function publish_to_hub($post_id) {
  3.  
  4. // we want to notify the hub for every feed
  5. $feed_urls = array();
  6. $feed_urls = apply_filters('push_feed_urls', $feed_urls); // <-- a filter to add some more feeds
  7. $feed_urls[] = get_bloginfo('atom_url');
  8. $feed_urls[] = get_bloginfo('rss_url');
  9. $feed_urls[] = get_bloginfo('rdf_url');
  10. $feed_urls[] = get_bloginfo('rss2_url');
  11.  
  12. // remove dups (ie. they all point to feedburner)
  13. $feed_urls = array_unique($feed_urls);
  14. // get the list of hubs
  15. $hub_urls = get_pubsub_endpoints();
  16. // loop through each hub
  17. foreach ($hub_urls as $hub_url) {
  18. $p = new Publisher($hub_url);
  19. // publish the update to each hub
  20. if (!$p->publish_update($feed_urls, "http_post_wp")) {
  21. // TODO: add better error handling here
  22. }
  23. }
  24. return $post_id;
  25. }
Add Comment
Please, Sign In to add comment