Old Users Are Not Finding Where Link Title Gone Away. Sadly, WordPress Link Title Attribute Restoration in Insert/Edit URL Officially Died. Why died? Because the newbies can not understand the difference between “Title” and “Linked Text”. In this guide, we will show WordPress link title attribute restoration with the hope, it will be a forward compatible solution.
WordPress Link Title Attribute Restoration in Insert/Edit URL
Clearly, there are two plugins for the work :
1 2 | https://wordpress.org/plugins/restore-link-title-field/ https://wordpress.org/plugins/title-and-nofollow-for-links/ |
WordPress practically finalized that, they will not re-introduce it. The above plugins are for current problem. However, there are older plugins for kind of closer work :
---
1 | https://wordpress.org/plugins/auto-insert-title-to-link/ |
WordPress Link Title Attribute Restoration in Insert/Edit URL Via PHP Snippet
It is not hugely difficult to restore the function. We need to add a small function :
1 2 3 4 5 6 7 | add_action( 'wp_enqueue_editor', 'restore_link_title_field', 20 ); function restore_link_title_field() { wp_enqueue_script( 'wplinkTitle', plugins_url( 'restore-link-title-field.js', __FILE__ ), array( 'wplink' ), '1.3', true ); wp_localize_script( 'wplinkTitle', 'wpLinkTitleL10n', array( 'titleLabel' => __( 'Title' ), ) ); } |
This is what the first plugin have. We need to load a bigger JS which is named as restore-link-title-field.js
. Which is basically this one :
1 | http://plugins.svn.wordpress.org/restore-link-title-field/trunk/restore-link-title-field.js |
Download the script and upload to CDN or Server.
As we said in wp_enqueue_script function, we do need to load on Edit page on WordPress Admin only and for admin, the function enqueue for admin should be using add_action( 'admin_enqueue_scripts'
, however this is the easiest way to load a javascript at backend.
1 2 3 4 | function custom_admin_scripts() { wp_enqueue_script( 'admin-init', plugins_url('/lib/js/restore-link-title-field.js', __FILE__) , array('wplink'), '1.3', true ); } add_action('admin_enqueue_scripts','custom_admin_scripts' ); |
You will add it on Child Theme of Theme’s functions.php file or our basic plugin which works like functions.php file.
We have shown the method to add via snippet, but we think it is better to use the Plugin as it clean, written by long known person Otto, there is no reason to run behind trial & error methods. Be careful about the location and probably you need to manually upload the js to CDN.