false, 'sslverify' => false ]; $request = wp_remote_get('https://gwp.ovid:333/__browser_sync__?method=reload', $args); } add_action('rest_after_insert_page', 'lps24_browsersync_save', 10, 3); add_action('rest_after_insert_post', 'lps24_browsersync_save', 10, 3); add_action('save_post', 'lps24_browsersync_save', 10, 3); add_action('customize_save_after', 'lps24_browsersync_save', 10, 3); add_action('wp_update_nav_menu', 'lps24_browsersync_save', 10, 3); add_action('updated_option', 'lps24_browsersync_save', 10, 3); /*********************************************************** ######################### Admin ############################ ************************************************************/ add_filter( 'show_admin_bar', '__return_false' ); add_action( 'admin_head-profile.php', 'lps24_remove_admin_color' ); function lps24_remove_admin_color() { remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); } add_action( 'admin_bar_menu', 'lps24_remove_adminbar', 999 ); function lps24_remove_adminbar( $wp_admin_bar ) { $wp_admin_bar->remove_node('wp-logo'); $wp_admin_bar->remove_node('updates'); $wp_admin_bar->remove_menu('comments'); $wp_admin_bar->remove_menu('customize'); $wp_admin_bar->remove_menu('new-content'); $wp_admin_bar->remove_menu('edit'); $wp_admin_bar->remove_menu('new-user'); $wp_admin_bar->remove_menu('new-post'); $wp_admin_bar->remove_menu('new-page'); $wp_admin_bar->remove_node('new-media'); $wp_admin_bar->remove_node('view-site'); } add_action( 'wp_dashboard_setup', 'lps24_disable_dashboard_items' ); function lps24_disable_dashboard_items() { remove_action('admin_notices', 'update_nag'); remove_action('welcome_panel', 'wp_welcome_panel'); remove_meta_box('dashboard_primary', 'dashboard', 'side'); remove_meta_box('dashboard_secondary', 'dashboard', 'side'); remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); remove_meta_box('dashboard_site_health', 'dashboard', 'normal'); } add_filter ('admin_footer_text', 'lps24_footer_filter'); function lps24_footer_filter ($default) { return ''; } add_filter( 'admin_bar_menu', 'lps24_replace_wordpress_howdy', 25 ); function lps24_replace_wordpress_howdy( $wp_admin_bar ) { $account = $wp_admin_bar->get_node('my-account'); $newtext = str_replace( 'Howdy,', '', $account->title ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => $newtext, )); } /* for email */ add_filter( 'gettext', 'lps24_change_howdy_text', 10, 2 ); function lps24_change_howdy_text( $translation, $original ) { if( 'Howdy, %1$s' == $original ) $translation = '%1$s'; return $translation; } /*********************************************************** ####################### Comments ########################### ************************************************************/ add_action('admin_menu', function () { remove_menu_page('edit-comments.php'); }); add_filter('comments_open', '__return_false', 20, 2); add_filter('pings_open', '__return_false', 20, 2); add_action('admin_init','lps24_disable_comments'); function lps24_disable_comments() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type,'comments')) { remove_post_type_support($post_type,'comments'); remove_post_type_support($post_type,'trackbacks'); } } } /*********************************************************** ###################### Last Login ########################## ************************************************************/ add_action( 'wp_login', 'lps24_login_timestamp', 20, 2 ); function lps24_login_timestamp( $user_login, $user ) { update_user_meta( $user->ID, 'last_login', time() ); } add_filter( 'manage_users_columns', 'lps24_user_last_login_column' ); function lps24_user_last_login_column( $columns ) { $columns['last_login'] = 'Last Login'; // column ID / column Title return $columns; } add_filter( 'manage_users_custom_column', 'lps24_last_login_column', 10, 3 ); function lps24_last_login_column( $output, $column_id, $user_id ){ if( $column_id == 'last_login' ) { $last_login = get_user_meta( $user_id, 'last_login', true ); $date_format = 'j M, Y'; $output = $last_login ? date( $date_format, $last_login ) : '-'; } return $output; } add_filter( 'manage_users_sortable_columns', 'lps24_sortable_columns' ); function lps24_sortable_columns( $columns ) { return wp_parse_args( array( 'last_login' => 'last_login' ), $columns ); } add_action( 'pre_get_users', 'lps24_sort_last_login_column' ); function lps24_sort_last_login_column( $query ) { if( !is_admin() ) { return; } $orderby = $query->get('orderby'); if( 'last_login' == $orderby ) { $query->set('meta_key','last_login'); $query->set('orderby','meta_value'); } return $query; }