Hot answers tagged

7

The dialog HTML comes from WP_Editors::wp_link_dialog() but no hooks in there. We could instead use jQuery to append the custom HTML to the link dialog and try to override e.g. the wpLink.getAttrs(), because it's very short ;-) Demo example: jQuery( document ).ready( function( $ ) { $('#link-options').append( '<div> <...


2

Add this function in your theme's functions.php function my_enqueue($hook) { if ('post.php' != $hook ) { return; } wp_enqueue_script('my_custom_script', get_template_directory_uri() . '/js/myscript.js'); } add_action('admin_enqueue_scripts', 'my_enqueue');` In myscript.js place this code jQuery(document).ready(function(){ jQuery('#...


2

Looking at the core, there's no trace of any filter or action in the wp_link_dialog function, which would have made your life easier... Investigating how others has solved this problem, there's a plugin that does more or less the same as you want. Basically it deregisters the wplink.js, wp_deregister_script('wplink'); and registers again a modified version ...



Only top voted, non community-wiki answers of a minimum length are eligible