| 1 |
<?php |
| 2 |
/** |
| 3 |
* Bootstraps the Fonts library page in wp-admin. |
| 4 |
* |
| 5 |
* @package gutenberg |
| 6 |
*/ |
| 7 |
|
| 8 |
// Priority 11 to run after Core's menu.php sets up the fonts menu. |
| 9 |
add_action( 'admin_menu', 'gutenberg_register_fonts_menu_item', 11 ); |
| 10 |
|
| 11 |
/** |
| 12 |
* Registers the Fonts menu item under Appearance using the font-library page. |
| 13 |
* Removes Core's fonts menu item first to prevent duplication. |
| 14 |
*/ |
| 15 |
function gutenberg_register_fonts_menu_item() { |
| 16 |
// Remove Core's fonts menu item if it exists. |
| 17 |
remove_submenu_page( 'themes.php', 'font-library.php' ); |
| 18 |
|
| 19 |
add_submenu_page( |
| 20 |
'themes.php', |
| 21 |
__( 'Fonts', 'gutenberg' ), |
| 22 |
__( 'Fonts', 'gutenberg' ), |
| 23 |
'edit_theme_options', |
| 24 |
'font-library-wp-admin', |
| 25 |
'gutenberg_font_library_wp_admin_render_page' |
| 26 |
); |
| 27 |
} |
| 28 |
|