Last active
March 14, 2017 13:40
-
-
Save raftaar1191/bae879ee6e650a4c1f0580ed7593d52b to your computer and use it in GitHub Desktop.
Add sub menu in media tab of admin menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// check if function does not exist | |
if ( ! function_exists( 'rtmedia_add_admin_bar_media_sub_menu_for_upload' ) ) { | |
function rtmedia_add_admin_bar_media_sub_menu_for_upload() { | |
// Please change the page_slug if you want from here | |
$page_slug = 'file-upload'; | |
// check if RTMEDIA_MEDIA_SLUG is already defined | |
if ( defined( 'RTMEDIA_MEDIA_SLUG' ) ) { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'my-account-' . RTMEDIA_MEDIA_SLUG, | |
'id' => 'my-account-media-' . $page_slug, | |
'title' => 'Upload', | |
'href' => trailingslashit( get_rtmedia_user_link( get_current_user_id() ) ) . RTMEDIA_MEDIA_SLUG . '?' . $page_slug . '=1', | |
) ); | |
} | |
} | |
} | |
add_action( 'rtmedia_add_admin_bar_media_sub_menu', 'rtmedia_add_admin_bar_media_sub_menu_for_upload', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please the above snippet in functions.php of child themes.