Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Last active March 14, 2017 13:40
Show Gist options
  • Save raftaar1191/bae879ee6e650a4c1f0580ed7593d52b to your computer and use it in GitHub Desktop.
Save raftaar1191/bae879ee6e650a4c1f0580ed7593d52b to your computer and use it in GitHub Desktop.
Add sub menu in media tab of admin menu
<?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 );
@raftaar1191
Copy link
Author

Please the above snippet in functions.php of child themes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment