WordPress开发者和主题制作者的搜索引擎



wp_admin_bar_shortlink_menu ›

Since3.1.0
已弃用n/a
wp_admin_bar_shortlink_menu ( $wp_admin_bar )
参数:
  • (WP_Admin_Bar) $wp_admin_bar
    Required: Yes
定义在:
文档:

Provide a shortlink.



源码

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_menu(
		array(
			'id'    => $id,
			'title' => __( 'Shortlink' ),
			'href'  => $short,
			'meta'  => array( 'html' => $html ),
		)
	);
}