对这是可能的。将自定义链接添加到href
函数的属性,可能包含url的属性。您分析的参数计划,如关于全局$_GET
如果参数正确,请运行文件、脚本等。
例如,请参见href
-参数我在href属性中添加了以下get参数。
$scheme = ( is_ssl() ? \'https\' : \'http\' );
$url = $scheme . \'://\' . $_SERVER[ \'HTTP_HOST\' ] . $_SERVER[ \'REQUEST_URI\' ];
$str = array( \'?debug\', \'&debug\', \'#debugobjects\' );
$url = esc_url( str_replace( $str, \'\', $url ) );
$get = \'?\';
if ( FALSE !== strpos( $url, \'?\' ) ) {
$get = \'&\';
}
$href = $url . $get . "debug#debugobjects";
在管理栏中添加自定义项的完整源。您可以在下面的
repo.
$wp_admin_bar->add_menu(
array(
\'parent\' => \'network-admin\',
\'secondary\' => FALSE,
\'id\' => \'network-\' . self::get_textdomain(),
\'title\' => self::get_plugin_data( \'Name\' ),
\'meta\' => array( \'class\' => $classes ),
\'href\' => network_admin_url( \'settings.php?page=\' . plugin_basename( __FILE__ ) ),
)
);
$scheme = ( is_ssl() ? \'https\' : \'http\' );
$url = $scheme . \'://\' . $_SERVER[ \'HTTP_HOST\' ] . $_SERVER[ \'REQUEST_URI\' ];
$str = array( \'?debug\', \'&debug\', \'#debugobjects\' );
$url = esc_url( str_replace( $str, \'\', $url ) );
$get = \'?\';
if ( FALSE !== strpos( $url, \'?\' ) ) {
$get = \'&\';
}
$href = $url . $get . "debug#debugobjects";
$wp_admin_bar->add_menu(
array(
\'id\' => \'debug_objects\',
\'parent\' => \'top-secondary\',
\'title\' => \'<img style="float:left;height:28px;" src="\'
. plugins_url( \'/img/bug-32.png\', parent::$plugin )
. \'" alt="The Bug" />\'
. __( \' Objects\', self::get_textdomain() ),
\'meta\' => array( \'class\' => $classes ),
\'href\' => $href
)
);