-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathshow-menu-slugs.php
43 lines (35 loc) · 1.14 KB
/
show-menu-slugs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Plugin Name: Freemius Menu Slugger
* Plugin URI: http://freemius.com/
* Description: Adds the menu and submenu slugs.
* Version: 1.0.0
* Author: Freemius
* Author URI: http://freemius.com
* License: GPL2
*/
/**
* @package Freemius Menu Slugger
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function fs_add_slugs() {
global $menu, $submenu;
$slug_template = '<br><span style="color: yellow; background: #000; display: inline-block; padding: 1px 5px; font-size: 10px;">[%s]</span>';
foreach ( $menu as $index => $meta ) {
$menu[$index][0] = $meta[0] . sprintf($slug_template, $meta[2]);
}
foreach ( $submenu as $menu_slug => $submenu_items ) {
foreach ($submenu_items as $index => $meta) {
$submenu[$menu_slug][$index][0] = $meta[0] . sprintf($slug_template, $meta[2]);
}
}
}
function fs_menu_slugger_init() {
add_action( 'admin_menu', 'fs_add_slugs', 99999999 );
}
add_action( 'plugins_loaded', 'fs_menu_slugger_init' );