Use WP 3.1 Internal Linking ‘widget’ as a meta_box

WordPress 3.1 Internal Linking feature was coded as a TinyMCE editor plugin so its not really a widget or a meta box but you can code your own meta box and reuse the functiona needed for that.

The files you need to look at are

  • /wp-includes/js/tinymce/wp-mce-link.php
  • /wp-includes/js/tinymce/plugins/wplink/js/wplink.js
    and maybe a few more but these are the main files you will need to achieve this functionality.

Side note: I can tell you that up until now when ever i needed to let my user add a url to a post or a page as a custom field i always created a dropdown select with the names of my posts and there id as value, then when i needed to show that link i’d call get_the_permalink(selected_ID);.
Now i know that this won’t work in all cases but its an option and i wanted to post it here for future reference.

Hope this helps,

Ohad.

Leave a Comment