WordPress users that updated the blog platform to version 3.5 might have observed that the link manager is missing from the admin pages:
It seems that WordPress announced this as one of the major core changes when they released version 3.5:
One other major change is the Link Manager. If you’re using it, you’ll want to install the Link Manager plugin – http://wordpress.org/extend/plugins/link-manager/ – because it’s going away. Don’t worry, if you’re using it, it will still be there, but if you’ve never used it, it will become invisible.
I have two WordPress installations, one locally, for development, and the “production”, on this site. What is extremely weird is that both are now updated to version 3.7.1 (I think) but the link manager is missing only from my local WordPress instance. I did some head banging until I managed to reinstate this menu entry because I definitely do not want to install a plugin for this. I do not like plugins because these are just code out of my own control and I had a lot of problems with compatibility in the past. Actually, this entire effort of revamping this blog’s theme was also due to my intention to strip altogether all plugins and use only my own code.
There are at least three options to restore the WordPress link manager in the admin menus:
- Use their plugin — don’t want plugins; not an option for me
- Tweak WordPress code — no ! I don’t want to do this with each and every WordPress update;
- Change options directly in database — might be, but there are more elegant options;
- Use a convenience filter in functions.php; much better;
- Use a convenience action in functions.php; most flexible and my choice too.
Changing code in WordPress system/ admin files
Although definitely not an option for me, I will discuss this solution too. From starters, displaying this admin menu link manager is set by the option link_manager_enabled
. Prior to WP 3.5, the default schema had this option on 1. After 3.5, this was set to 0. Below is a code excerpt from schema.php
(found in wp-admin folder):
// 2.8 'timezone_string' => $timezone_string, // 3.0 'page_for_posts' => 0, 'page_on_front' => 0, // 3.1 'default_post_format' => 0, // 3.5 'link_manager_enabled' => 0,
Looking for this option inside options.php was one of the solutions provided for this issue with version 3.5. However, versions post 3.5 do not have this in options.php anymore so the only way of doing it is to change the schema definitions and re–update the database. Messy and dangerous. Move on.
Change database option value for link_manager_enable
This is quick. With your preferred SQL browser, query to find link_manager_enable option and set its value to 1:
This is a nice solution that works perfectly, although a bit more technical than preferred and with its own drawbacks: it is very likely that each WordPress database update this option will be set, again, on 0 (zero). But at least you know where the problem is, you may check the DB if the WordPress link manager disappears and set it again to 1.
Use a convenience filter in functions.php
Add the following line in your functions.php, or equivalent (if you have a custom theme):
add_filter( 'pre_option_link_manager_enabled', '__return_true' );
Use a convenience action in functions.php
This is by far my preferred approach. The one above (the filter) is also cool, but the add_action snippet allows accommodation with some additional logic if I want. Basically the code is:
function set_link_manager_on() { $enabled = get_option( 'link_manager_enabled' ); if ( 1 !== $enabled ) update_option( 'link_manager_enabled', 1 ); } add_action('admin_init', 'set_link_manager_on');
Since you might fancy more complex validation logic, this method has many advantages, including the fact that it always checks the value of the link_manager_enabled
option and updates only when found set to 0 (zero).
Closing
Of course, the reverse is also valid: if you have the link manager enabled and want it disabled by default, just reverse all the logic in each of these solutions. For example, for using the convenience action:
function set_link_manager_off() { $enabled = get_option( 'link_manager_enabled' ); if ( 0 !== $enabled ) update_option( 'link_manager_enabled', 0 ); } add_action('admin_init', 'set_link_manager_off');
Hope you find this post useful. I would be glad to receive and reply to any comments from your side.
Cheers !
Leave a Reply