wp_link_manager_disabled_message()
- Since
- 3.5.0
- Source
wp-admin/includes/bookmark.php:332
Compatibility
- WordPress
- since 3.5.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Performance profile
How much work a call to wp_link_manager_disabled_message() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Light
- Scaling
- Constant
- Instructions
- 4–59
- Plugin surface
- None
- Called by
- 0
Only touches the object cache, via wp_cache_get().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 86.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- cacheobject cache
wp_cache_get()one call below wp_link_manager_disabled_message() - hookthird-party callbacks
apply_filters()one call below wp_link_manager_disabled_message()
Further down the call graph this can also reach option, query, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 7 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_link_manager_disabled_message() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!$pagenow | 4 | none |
$pagenow | 25 | add_filter(), current_user_can(), remove_filter(), __(), wp_die() |
$pagenow && !empty($plugins) && !is_plugin_inactive() | 34 | add_filter(), current_user_can(), remove_filter(), get_plugins(), is_plugin_inactive(), __(), wp_die() |
$pagenow && empty($plugins) && !current_user_can() | 34 | add_filter(), current_user_can(), remove_filter(), get_plugins(), current_user_can(), __(), wp_die() |
$pagenow && !empty($plugins) && is_plugin_inactive() && !current_user_can() | 38 | add_filter(), current_user_can(), remove_filter(), get_plugins(), is_plugin_inactive(), current_user_can(), __(), wp_die() |
$pagenow && empty($plugins) && current_user_can() | 56 | add_filter(), current_user_can(), remove_filter(), get_plugins(), current_user_can(), self_admin_url(), wp_nonce_url(), __(), esc_url(), sprintf(), wp_die(), __(), wp_die() |
$pagenow && !empty($plugins) && is_plugin_inactive() && current_user_can() | 59 | add_filter(), current_user_can(), remove_filter(), get_plugins(), is_plugin_inactive(), current_user_can(), self_admin_url(), wp_nonce_url(), __(), esc_url(), sprintf(), wp_die(), __(), wp_die() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 86 instructions, 4–59 executed per call, 6 branches. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 10
- add_filter()Adds a callback function to a filter hook.
- current_user_can()Returns whether the current user has the specified capability.
- remove_filter()Removes a callback function from a filter hook.
- get_plugins()Checks the plugins directory and retrieve all plugin files with plugin data.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
- wp_die()Kills WordPress execution and displays HTML page with an error message.
- __()Retrieves the translation of $text.
- esc_url()Checks and cleans a URL.
- is_plugin_inactive()Determines whether the plugin is inactive.
Source code
function wp_link_manager_disabled_message() { global $pagenow; if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) { return; } add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 ); $really_can_manage_links = current_user_can( 'manage_links' ); remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 ); if ( $really_can_manage_links ) { $plugins = get_plugins(); if ( empty( $plugins['link-manager/link-manager.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=link-manager' ), 'install-plugin_link-manager' ); wp_die( sprintf( /* translators: %s: A link to install the Link Manager plugin. */ __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager plugin</a>.' ), esc_url( $install_url ) ) ); } } elseif ( is_plugin_inactive( 'link-manager/link-manager.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=link-manager/link-manager.php' ), 'activate-plugin_link-manager/link-manager.php' ); wp_die( sprintf( /* translators: %s: A link to activate the Link Manager plugin. */ __( 'Please activate the <a href="%s">Link Manager plugin</a> to use the link manager.' ), esc_url( $activate_url ) ) ); } } } wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) );}Changelog
Introduced in 3.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-admin/includes/bookmark.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.