[wp-trac] [WordPress Trac] #18042: Need a way to override wp_link_query()

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 8 22:24:45 UTC 2011


#18042: Need a way to override wp_link_query()
--------------------------+-----------------------------
 Reporter:  philfreo      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  3.2
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 In previous versions of WordPress, we were able to write a plugin which
 called add_filter on "tiny_mce_before_init" and then we were able to
 specify "external_link_list_url" which we gave it a list of all of the
 URLs on our site (we primarily linked to non-WordPress URLs on our site
 from this tool). Then when an author created a Link in the post tool the
 little popup would include a dropdown of all of the URLs/page titles that
 we specified.

 In WordPress 3.2 you have the new fancy "link to existing content" feature
 in the popup.

 The problem is that there is NO hook, filter, or pluggable function
 whatsoever to allow you to override the functionality of this.

 I needed to make the search results box return a list of pages (urls and
 titles) that I specified from a different database. In order order to do
 that I had to re-create the entire wp_link_query() function from wp-
 admin/includes/internal-linking.php to make it return search results from
 my own database. I put that function into a Plugin (to keep it out of
 Core) but then I had to hack core to rename wp_link_query() to
 wp_link_query_ORIGINAL() to get it to use my function and not the existing
 one.

 Either wp_link_query() needs to be a pluggable function or there need to
 be hooks that let you completely replace how it works.

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


More information about the wp-trac mailing list