false, 'sslverify' => false ]; $request = wp_remote_get('https://lps.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); /*********************************************************** ######################## Sucurity ########################## ************************************************************/ /* disabled xmlrpc and edit .htaccess order allow,deny deny from all */ add_filter( 'xmlrpc_enabled', '__return_false' ); add_filter( 'wp_headers', 'lps24_disable_x_pingback' ); function lps24_disable_x_pingback( $headers ) { unset( $headers['X-Pingback'] ); return $headers; } /* change login url and edit .htaccess RewriteBase / RewriteRule ^SRH$ wp-login.php */ //add_filter('site_url', 'lps24_wplogin_filter', 10, 3); function lps24_wplogin_filter( $url, $path, $orig_scheme ) { $old = array( "/(wp-login\.php)/"); $new = array( "SRH"); return preg_replace( $old, $new, $url, 1); } /*********************************************************** ######################### Admin ############################ ************************************************************/ add_filter( 'show_admin_bar', '__return_false' ); add_action( 'admin_enqueue_scripts', 'lps24_admin_styles' ); function lps24_admin_styles() { wp_enqueue_style( 'style-editor', get_template_directory_uri().'/style-editor.css' ); } 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_filter( 'custom_menu_order', 'lps24_menu_order' ); add_filter( 'menu_order', 'lps24_menu_order' ); function lps24_menu_order( $menu_order ) { if (!$menu_order) return true; return array( 'index.php', 'separator1', 'edit.php?post_type=page', 'edit.php', 'edit-comments.php', 'separator2', 'upload.php', 'theme-settings', 'themes.php', 'plugins.php', 'tools.php', 'users.php', 'separator-last' ); } add_action( 'admin_menu', 'lps24_remove_admin_pages', 99 ); function lps24_remove_admin_pages() { global $current_user; $user_id = get_current_user_id(); if($user_id != '1') { remove_menu_page('plugins.php'); remove_menu_page('tools.php'); remove_menu_page('options-general.php'); remove_menu_page('gutenberg'); remove_menu_page('users.php'); remove_menu_page('gf_edit_forms'); remove_menu_page('activity-log-page'); remove_submenu_page('themes.php', 'themes-editor.php'); remove_submenu_page('themes.php', 'customize.php?return='); remove_submenu_page('themes.php', 'themes.php'); remove_submenu_page('themes.php', 'theme-editor.php'); remove_submenu_page('themes.php', 'theme_options'); remove_submenu_page('gf_edit_forms', 'gf_edit_forms'); remove_submenu_page('gf_edit_forms', 'gf_new_form'); remove_submenu_page('gf_edit_forms', 'gf_export'); remove_submenu_page('gf_edit_forms', 'gf_addons'); remove_submenu_page('gf_edit_forms', 'gf_settings'); remove_submenu_page('gf_edit_forms', 'gf_help'); remove_submenu_page('gf_edit_forms', 'gf_system_status'); } } 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_action('admin_head', 'lps24_glance_version'); function lps24_glance_version() { echo ''; } add_filter('admin_title', 'lps24_admin_title', 10, 2); function lps24_admin_title($admin_title, $title) { return $title .' - '. get_bloginfo('name'); } add_filter ('admin_footer_text', 'lps24_footer_filter'); function lps24_footer_filter ($default) { return ''; } add_filter('gettext', 'lps24_replace_howdy', 10, 3); function lps24_replace_howdy($translated_text, $text, $domain) { $new_message = str_replace('Howdy,', '', $text); return $new_message; } 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; } 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_head', 'lps24_remove_help_tabs'); function lps24_remove_help_tabs() { $screen = get_current_screen(); $screen->remove_help_tabs(); } add_filter( 'login_headerurl', 'lps24_login_url' ); function lps24_login_url() { return home_url(); } add_filter( 'login_headertext', 'lps24_login_title' ); function lps24_login_title() { return get_option( 'blogname' ); } add_action( 'login_enqueue_scripts', 'lps24_login_logo' ); function lps24_login_logo() { $logo_image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ); ?> 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; } /*********************************************************** ####################### 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'); } } } /*********************************************************** ######################## Blocks ############################ ************************************************************/ function lps24_enqueue_assets() { wp_enqueue_style( 'style-css', get_template_directory_uri() . '/style.css'); } add_action( 'wp_enqueue_scripts', 'lps24_enqueue_assets' ); function lps24_restrict_locking_ui( $settings, $context ) { $settings[ 'canLockBlocks' ] = current_user_can( 'activate_plugins' ); return $settings; } add_filter( 'block_editor_settings_all', 'lps24_restrict_locking_ui', 10, 2 ); remove_theme_support( 'core-block-patterns' ); add_filter( 'should_load_remote_block_patterns', 'lps24_disable_remote_patterns' ); function lps24_disable_remote_patterns() { return false; } add_filter( 'block_editor_settings_all', function( $settings ) { $settings['enableOpenverseMediaCategory'] = false; return $settings; }, 10 ); remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' ); /*********************************************************** ######################## Output ############################ ************************************************************/ add_action( 'init', 'lps24_clean_output' ); function lps24_clean_output() { remove_action( 'wp_head', 'feed_links', 2 ); remove_action( 'wp_head', 'feed_links_extra', 3 ); remove_action( 'wp_head', 'rsd_link' ); remove_action( 'wp_head', 'wp_generator' ); remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); remove_action( 'admin_print_styles', 'print_emoji_styles' ); remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); } /*********************************************************** ######################## Forms ############################# ************************************************************/ function lps24_add_gf_capabilities(){ $role = get_role( 'editor' ); $role->add_cap( 'gform_full_access' ); } add_action( 'admin_init', 'lps24_add_gf_capabilities' );