get_error_codes(); // Invalid username. // Default: 'ERROR: Invalid username. Lost your password?' if ( in_array( 'invalid_username', $err_codes ) ) { $error = 'ERROR: Wrong information.'; } // Invalid email. if ( in_array( 'invalid_email', $err_codes ) ) { $error = 'ERROR: Wrong information.'; } // Incorrect password. // Default: 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' if ( in_array( 'incorrect_password', $err_codes ) ) { $error = 'ERROR: Wrong information.'; } return $error; } ); add_action('admin_init', function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === 'edit-comments.php') { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Disable support for comments and trackbacks in post types foreach (get_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'); } } }); // Close comments on the front-end add_filter('comments_open', '__return_false', 20, 2); add_filter('pings_open', '__return_false', 20, 2); // Hide existing comments add_filter('comments_array', '__return_empty_array', 10, 2); // Remove comments page in menu add_action('admin_menu', function () { remove_menu_page('edit-comments.php'); }); // Remove comments links from admin bar function my_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu('comments'); } add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' ); // Move Yoast to Bottom of Edit Screen add_filter( 'wpseo_metabox_prio', function() { return 'low'; } ); // Remove jQuery Migrate // function remove_jquery_migrate($scripts) // { // if (!is_admin() && isset($scripts->registered['jquery'])) { // $script = $scripts->registered['jquery']; // if ($script->deps) { // Check whether the script has any dependencies // $script->deps = array_diff($script->deps, array( // 'jquery-migrate' // )); // } // } // } // add_action('wp_default_scripts', 'remove_jquery_migrate'); /** * Disable the emoji's */ function disable_emojis() { 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' ); add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 ); } add_action( 'init', 'disable_emojis' ); /** * Filter function used to remove the tinymce emoji plugin. * * @param array $plugins * @return array Difference betwen the two arrays */ function disable_emojis_tinymce( $plugins ) { if ( is_array( $plugins ) ) { return array_diff( $plugins, array( 'wpemoji' ) ); } else { return array(); } } /** * Remove emoji CDN hostname from DNS prefetching hints. * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed for. * @return array Difference betwen the two arrays. */ function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) { if ( 'dns-prefetch' == $relation_type ) { /** This filter is documented in wp-includes/formatting.php */ $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ); $urls = array_diff( $urls, array( $emoji_svg_url ) ); } return $urls; } // Disable dashicon // function remove_dashicons_wordpress() { // if ( ! is_user_logged_in() ) { // wp_dequeue_style('dashicons'); // wp_deregister_style( 'dashicons' ); // } // } // add_action( 'wp_enqueue_scripts', 'remove_dashicons_wordpress' ); // Deactivate Eicons in Elementor add_action( 'wp_enqueue_scripts', 'js_remove_default_stylesheet', 20 ); function js_remove_default_stylesheet() { // Don't remove it in the backend if ( is_admin() || current_user_can( 'manage_options' ) ) { return; } wp_deregister_style( 'elementor-icons' ); } // Disable WP Embed function remove_wp_embed(){ wp_dequeue_script( 'wp-embed' ); } add_action( 'wp_footer', 'remove_wp_embed' ); // Change gravity form error message from h2 to span add_filter( 'gform_validation_message', 'change_message', 10, 2 ); function change_message( $message, $form ) { return "There was a problem with your submission. Please review the fields below."; } // Change gravity form required legend text add_filter( 'gform_required_legend', function( $legend, $form ) { return 'An asterisk (*) indicates a required field.'; }, 10, 2 ); // force AJAX on all GForms add_filter( 'gform_form_args', 'setup_form_args' ); function setup_form_args( $form_args ) { $form_args['ajax'] = true; return $form_args; } // This code snippet will programmatically replace the URLs returned by get_permalink(), // this updates the HTML to point to the external URL instead of relying only on a redirect.T function pm_use_external_redirects_as_canonical_urls( $permalink, $post ) { global $permalink_manager_external_redirects; $post = ( is_integer( $post ) ) ? get_post( $post ) : $post; if ( !empty( $permalink_manager_external_redirects[ $post->ID ] ) ) { $permalink = $permalink_manager_external_redirects[ $post->ID ]; } return $permalink; } add_filter( 'permalink_manager_filter_final_post_permalink', 'pm_use_external_redirects_as_canonical_urls', 10, 2 );