When developing a website with WordPress, one of important thing you need to consider before you start to upload tonne of media files to your media library is how to organise your media files. At the early stage after WordPress installation it may not seems any issue, but in long run you will realise how bad is WordPress in organising media files that have been uploaded. Its a total failure since WordPress Media Library does not have any media library manager or even basic folder function that should come natively with the cms.
[Read more…] about How to organise your media files in WordPress?plugin
How To Remove Dashboard Widget For Non Admin
Berguna bila kita nak bagi public accout access wp-admin. Mungkin ada beberapa info yang tak perlu depa tau kita remove.
Example #1 using remove_meta_box :
add_action('wp_dashboard_setup','remove_dashboard_widgets"); function remove_jetpack(){ if ( ! current_user_can('manage_options') ){ remove_meta_box( 'dashboard_quick_press','dashboard', 'side' ); //Quick Press widget remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' ); //Recent Drafts remove_meta_box( 'dashboard_primary', 'dashboard', 'side' ); //WordPress.com Blog remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' ); //Other WordPress News remove_meta_box( 'dashboard_incoming_links','dashboard', 'normal' ); //Incoming Links remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' ); //Plugins remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); remove_meta_box('dashboard_activity', 'dashboard', 'normal'); remove_meta_box('tribe_dashboard_widget', 'dashboard', 'normal'); } }
Example #2 using unset() :
add_action('wp_dashboard_setup','remove_dashboard_widgets"); function remove_jetpack(){ global $wp_meta_boxes; if ( ! current_user_can('manage_options') ){ unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } }
To disable all dashboard widget including custom widget we can do like this
add_action('wp_dashboard_setup','remove_dashboard_widgets"); function remove_jetpack(){ global $wp_meta_boxes; if ( ! current_user_can('manage_options') ){ unset($wp_meta_boxes['dashboard']); } }