function checkit() { document.getElementById(\'rememberme\').checked = true; } window.onload = checkit; '; } add_action( 'login_head', 'remember_me_checked' ); } // Disable WP REST API (2023) // update: causes conflict with "popular posts" widget /* add_filter( 'rest_authentication_errors', function( $result ) { // If a previous authentication check was applied, // pass that result along without modification. if ( true === $result || is_wp_error( $result ) ) { return $result; } // No authentication has been performed yet. // Return an error if user is not logged in. if ( ! is_user_logged_in() ) { return new WP_Error( 'rest_not_logged_in', __( 'You are not currently logged in.' ), array( 'status' => 401 ) ); } // Our custom authentication check should have no effect // on logged-in requests return $result; }); */ // 2022 disable comments without plugin // First, this will disable support for comments and trackbacks in post types function df_disable_comments_post_types_support() { $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'); } } } # https://keithgreer.uk/wordpress-code-completely-disable-comments-using-functions-php add_action('admin_init', 'df_disable_comments_post_types_support'); // Then close any comments open comments on the front-end just in case function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Finally, hide any existing comments that are on the site. function df_disable_comments_hide_existing_comments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);