wp_admin_bar_shortlink_menu

Advertisement

Summery Summery

Provide a shortlink.

Syntax Syntax

wp_admin_bar_shortlink_menu( WP_Admin_Bar $wp_admin_bar )

Parameters Parameters

$wp_admin_bar

(Required)

Source Source

File: wp-includes/admin-bar.php

function wp_admin_bar_shortlink_menu( $wp_admin_bar ) {
	$short = wp_get_shortlink( 0, 'query' );
	$id    = 'get-shortlink';

	if ( empty( $short ) ) {
		return;
	}

	$html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" />';

	$wp_admin_bar->add_node(
		array(
			'id'    => $id,
			'title' => __( 'Shortlink' ),
			'href'  => $short,
			'meta'  => array( 'html' => $html ),
		)
	);
}

Advertisement

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Advertisement

Leave a Reply