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
| //Custom quantity of columns on the dashboard | |
| function restore_dashboard_columns() { | |
| add_screen_option( | |
| 'layout_columns', | |
| array( | |
| 'max' => 4, // Maximum number of columns | |
| 'default' => 2 // Value set as the default | |
| ) | |
| ); | |
| } |
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
| define( 'WP_AUTO_UPDATE_CORE', false ); |
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
| //Sender Email Custom | |
| add_filter('wp_mail_from', 'new_mail_from'); | |
| add_filter('wp_mail_from_name', 'new_mail_from_name'); | |
| function new_mail_from($old) { | |
| return 'email@yourwebsite.com'; | |
| } | |
| function new_mail_from_name($old) { | |
| return 'Site Name'; |
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
| //Remove Settings and Status submenus for non-administrator users | |
| if ( ! current_user_can('manage_options') ) { | |
| add_action( 'admin_menu', 'my_remove_menu_pages', 999 ); | |
| function my_remove_menu_pages() { | |
| remove_submenu_page('woocommerce', 'woocommerce_settings'); | |
| remove_submenu_page('woocommerce', 'woocommerce_status'); | |
| }} |
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
| //User has access only to your posts | |
| function posts_for_current_author($query) { | |
| global $pagenow; | |
| if( 'edit.php' != $pagenow || !$query->is_admin ) | |
| return $query; | |
| if( !current_user_can( 'manage_options' ) ) { | |
| global $user_ID; | |
| $query->set('author', $user_ID ); | |
| } | |
| return $query; |
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
| //User only has access to your uploaded media | |
| function my_files_only( $wp_query ) { | |
| if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false ) { | |
| if ( !current_user_can( 'level_5' ) ) { | |
| global $current_user; | |
| $wp_query->set( 'author', $current_user->id ); | |
| } | |
| } | |
| } | |
| add_filter('parse_query', 'my_files_only' ); |
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
| //Remove menus for non-administrator users | |
| add_action('admin_menu', 'remove_menus'); | |
| function remove_menus () { | |
| global $menu; | |
| if( (current_user_can('install_themes')) ) { // Hides the menus for users who have the lowest role that | |
| $restricted = array(); | |
| }else{ | |
| $restricted = array( | |
| __('Dashboard'), | |
| __('Posts'), |
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
| //Add fields in the user profile | |
| function my_new_contactmethods( $contactmethods ) { | |
| //Add Twitter | |
| $contactmethods['twitter'] = 'Twitter'; | |
| //Add Facebook | |
| $contactmethods['facebook'] = 'Facebook'; | |
| return $contactmethods; | |
| } | |
| add_filter('user_contactmethods','my_new_contactmethods',10,1); |
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
| //Remove fields in the user profile | |
| add_filter('user_contactmethods','hide_profile_fields',10,1); | |
| function hide_profile_fields( $contactmethods ) { | |
| unset($contactmethods['website']); | |
| unset($contactmethods['aim']); | |
| unset($contactmethods['jabber']); | |
| unset($contactmethods['yim']); | |
| return $contactmethods; | |
| } |
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
| //Remove comments, tags, categories, and author of the posts listing, pages and media | |
| //Remove of the posts listing | |
| function custom_post_columns($defaults) { | |
| unset($defaults['comments']); | |
| unset($defaults['tags']); | |
| unset($defaults['author']); | |
| unset($defaults['categories']); | |
| return $defaults; | |
| } | |