Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#18042 closed enhancement

Need a way to override wp_link_query() — at Initial Version

Reported by: philfreo Owned by:
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.2
Component: Editor Keywords: has-patch commit
Focuses: Cc:


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.

Change History (0)

Note: See TracTickets for help on using tickets.