[wp-trac] [WordPress Trac] #18506: Filter to allow pingback URLs to be added (from custom fields, etc.)

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 24 04:26:26 UTC 2011


#18506: Filter to allow pingback URLs to be added (from custom fields, etc.)
------------------------------+-----------------------------
 Reporter:  alexkingorg       |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Pings/Trackbacks  |    Version:  3.2.1
 Severity:  normal            |   Keywords:  has-patch
------------------------------+-----------------------------
 The current pingback code does not allow for this URL to be added to the
 pingback stack programatically - there are no filters to use. The attached
 patch allows URLs to be filtered into the list, before they are compared
 against the "pung" list. This means nothing else needs to change in the
 code flow, and the feature should "just work".

 This would be useful in a number of scenarios, here is one:

 > plugin/theme stores a URL value as structured data in a custom field
 (post meta) for a link post. This URL is the focus of the post and should
 generate a pingback.

 Example code that would use this filter:

 {{{
 function pingback_format_link_url($post_links, $post_id) {
         $url = get_post_meta($post_id, '_format_link_url', true);
         if (!empty($url) && !in_array($url, $post_links)) {
                 $post_links[] = $url;
         }
         return $post_links;
 }
 add_filter('pre_ping_post_links', 'pingback_format_link_url', 10, 2);
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18506>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list