WordPress: Loại bỏ Các Phần Tự Định từ Phần Đầu



Trong một số trường hợp, chúng ta cần loại bỏ tất cả các thẻ meta mặc định từ các mẫu WordPress.
Để làm điều này, chỉ cần thêm đoạn mã sau vào tệp functions.php của bạn

remove_action('wp_head', 'wp_print_styles', 8);
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
remove_action('wp_head', 'wp_generator');
add_filter('show_admin_bar', '__return_false');