vnfaster@gmail.com

Function hay wordpress

Tổng hợp đầy đủ những Functions Wordpress hay được chọn lọc từ nhiều nguồn bởi Vnkings – Admin DashBoard, Post type, Widget, Menu, Theme, Editor…
Tổng hợp bởi Tiến Lực – Ngô Thoại

function hide_attributess_for_mobile_booking_data_panel( $tabs ) {
$tabs[ 'general' ][ 'class' ][] = 'hide_if_mobile-booking';
$tabs[ 'inventory' ][ 'class' ][] = 'hide_if_mobile-booking';
$tabs[ 'shipping' ][ 'class' ][] = 'hide_if_mobile-booking';
$tabs[ 'linked_product' ][ 'class' ][] = 'hide_if_mobile-booking';
$tabs[ 'variations' ][ 'class' ][] = 'hide_if_mobile-booking';
$tabs[ 'advanced' ][ 'class' ][] = 'hide_if_mobile-booking';
$tabs[ 'attribute' ][ 'class' ][] = 'hide_if_mobile-booking';
return $tabs;
}

add_filter( 'woocommerce_product_data_tabs', 'hide_attributess_for_mobile_booking_data_panel', 10, 1);

Trong đó:

mobile-booking: là value  Product type

hide
: là ẩn
Muốn  hiển thị có thể thay hide bằng show

Kết quả:

 

Làm sao để lấy được id insert tiếp theo của bảng trươc khi chèn dữ liệu trong wordpress?

Thêm thành phố (State) cho Quốc gia Việt Nam trong trang thanh toán Woocommerce


public function adding_cheng_country_states( $states ) {
$states['VN'] = array(
'VN01' => __('Hà Nội', 'woocommerce'),
'VN02' => __('Đà Nẵng', 'woocommerce'),
'VN03' => __('TP. Hồ Chính Minh', 'woocommerce'),
'VN04' => __('Bắc Ninh', 'woocommerce'), 
'VN05' => __('Nam Định', 'woocommerce'),
'VN06' => __('Hải Dương', 'woocommerce'),
);
return $states;
}

Hook vào woocommerce_states

add_filter( 'woocommerce_states', array($this,'adding_cheng_country_states' ));</pre>

Kết quả:

 

NGÔ THOẠI

Thay đổi vị trí field trong trang checkout


add_filter( 'woocommerce_default_address_fields', 'cheng_priority_checkout_fields' );
function cheng_priority_checkout_fields( $fields ) {
// default priorities:
// 'first_name' - 10
// 'last_name' - 20
// 'company' - 30
// 'country' - 40
// 'address_1' - 50
// 'address_2' - 60
// 'city' - 70
// 'state' - 80
// 'postcode' - 90
$fields['state']['priority'] = 8;
return $fields;
}

 

Có thể thay đổi vị trí bằng cách thay đổi giá trị priority cho các field name

Thêm đoạn này vào File functions.php

add_filter( 'page_link', 'vnkings_remove_parent_page_from_link', 10, 3 );
function vnkings_remove_parent_page_from_link( $permalink, $post, $sample)
{
	$parrent_id = wp_get_post_parent_id($post);
	if ($parrent_id) {
		$post_parent = get_post($parrent_id); 
		$slug_parent = '/'.$post_parent->post_name;
		$permalink = str_replace( $slug_parent, '', $permalink );
		
	}
	return $permalink;
	flush_rewrite_rules();
}

Tạo hàm chứa các thông báo với 1 $_SESSION là $_SESSION[‘cheng_flash_message’][];

 

 

$url : link trang hiển thị biến $SESSION

$message: Thông báo

$message_type: Kiểu thông báo

 

 

Gọi hàm thực thi

 

In biến $_SESSION – chính là show thông báo

NGÔ THOẠI

<?php
// Tạo function lấy danh sách Taxonomy
function vnk_taxonomylist(){
	$post_type = 'pagebai';
	$taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );
	foreach( $taxonomies as $taxonomy ){
		$terms = get_terms( $taxonomy );
		foreach( $terms as $term ){ ?>
			<a href="<?php echo get_term_link($term->term_id) ?>"><?php echo $term->name; ?></a>
		<?php }
	}
}
// hiển thị các Taxonomy:
vnk_taxonomylist();
?>

2 cách nén code trong website wordpress

Cách 1: Viết hàm php


function sanitize_output($buffer)
{
$search = array(
'/\>[^\S ]+/s',
'/[^\S ]+\</s',
'/(\s)+/s'
);
$replace = array(
'>',
'<',
'\\1'
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
ob_start("sanitize_output");

 

Cách 2: Sử dụng htaccess


<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/x-javascript application/javascript
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css A31536000
ExpiresByType text/fonts A31536000
ExpiresByType text/x-component A31536000
ExpiresByType application/x-javascript A31536000
ExpiresByType application/javascript A31536000
ExpiresByType text/javascript A31536000
ExpiresByType text/x-js A31536000
ExpiresByType text/html A3600
ExpiresByType text/richtext A3600
ExpiresByType image/svg+xml A3600
ExpiresByType text/plain A3600
ExpiresByType text/xsd A3600
ExpiresByType text/xsl A3600
ExpiresByType text/xml A3600
ExpiresByType video/asf A31536000
ExpiresByType video/avi A31536000
ExpiresByType image/bmp A31536000
ExpiresByType application/java A31536000
ExpiresByType video/divx A31536000
ExpiresByType application/msword A31536000
ExpiresByType application/vnd.ms-fontobject A31536000
ExpiresByType application/x-msdownload A31536000
ExpiresByType image/gif A31536000
ExpiresByType application/x-gzip A31536000
ExpiresByType image/x-icon A31536000
ExpiresByType image/jpeg A31536000
ExpiresByType application/json A31536000
ExpiresByType application/vnd.ms-access A31536000
ExpiresByType audio/midi A31536000
ExpiresByType video/quicktime A31536000
ExpiresByType audio/mpeg A31536000
ExpiresByType video/mp4 A31536000
ExpiresByType video/mpeg A31536000
ExpiresByType application/vnd.ms-project A31536000
ExpiresByType application/x-font-otf A31536000
ExpiresByType application/vnd.ms-opentype A31536000
ExpiresByType application/vnd.oasis.opendocument.database A31536000
ExpiresByType application/vnd.oasis.opendocument.chart A31536000
ExpiresByType application/vnd.oasis.opendocument.formula A31536000
ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
ExpiresByType application/vnd.oasis.opendocument.text A31536000
ExpiresByType audio/ogg A31536000
ExpiresByType application/pdf A31536000
ExpiresByType image/png A31536000
ExpiresByType application/vnd.ms-powerpoint A31536000
ExpiresByType audio/x-realaudio A31536000
ExpiresByType image/svg+xml A31536000
ExpiresByType application/x-shockwave-flash A31536000
ExpiresByType application/x-tar A31536000
ExpiresByType image/tiff A31536000
ExpiresByType application/x-font-ttf A31536000
ExpiresByType application/x-font-woff A31536000
ExpiresByType application/vnd.ms-opentype A31536000
ExpiresByType audio/wav A31536000
ExpiresByType audio/wma A31536000
ExpiresByType application/vnd.ms-write A31536000
ExpiresByType application/font-woff A31536000
ExpiresByType application/vnd.ms-excel A31536000
ExpiresByType application/zip A31536000
</IfModule>

function vnkings_icon_post_type(){
?>
<style>
#adminmenu .menu-icon-tour div.wp-menu-image:before {
content: "\f322";
}
</style>
<?php
}
add_action( 'admin_head', 'vnkings_icon_post_type' );

Trong đó:

tour: tên post type

content: “\f322” : là mã icon

Có thể tham khảo các icon ở trang: https://developer.wordpress.org/resource/dashicons/#nametag

function vnkings_theme_setup() {

add_theme_support( 'custom-logo', array(
'width' => 250,
'height' => 50,
'flex-width' => true,
) );

}
add_action( 'after_setup_theme', 'vnkings_theme_setup' );

Trong đó :

width: là chiều rộng  của logo

height: là chiều cao của logo

flex-width: cho phép tùy chỉnh chiều rộng khi là true. Trong trường hợp là false chiều cao bị sẽ co theo tỷ lệ với chiều rộng.

Gọi ra logo

<div class="logo">
<?php the_custom_logo(); ?>
</div>

Một số loại website mà ta từng sử dụng chức năng lọc multi taxonomy như bất động sản, du lịch, shop.

Lọc theo taxonomy mình thấy query lọc trong tax_query tương đối phổ biến. Tuy nhiên hôm nay có 1 phương pháp lọc nữa đó là viết thẳng vào mảng array query. Relation là kiểu AND

$arg_fillter = array(
'post_type' => 'tour',
'posts_per_page' => -1,
'diadiem_Cat' => 'ha-noi',
'loai_hinh_du_lich' => 'team-buildding',
);

Trong đó:

diadiem_Cat : tên taxonomy A

loai_hinh_du_lich : tên taxonomy B
ha-noi: slug term trong taxonomy A
team_build_ding: slug term trong taxonomy B

Và ta truy vấn bình thường để có dữ liệu trong vòng while loop post

$id_vnkuser = "ID_Cua_Thanh_Vien";
// Đếm bài viết với Post type là Post
count_user_posts($id_vnkuser,'post');

// Đếm bài viết với Post_type là Custom_post_type
count_user_posts($id_vnkuser,'post_type_cua_ban');

Thêm đoạn code bên dưới vào file Functions.php:

// Thêm nhóm thành viên Vip, đặt level nhóm là 3.
$vnkings_new_user = add_role('vipuser', __( 'Vip User' ),
    array(
		'upload_files'         => true,
		'edit_others_pages'         => true,
		'edit_posts'         => true,
		'publish_posts'         => true,
		'read'         => true,
		'level_3' => true,
    )
);
// Lấy thông tin comment theo bài
$comments_count = wp_count_comments(get_the_ID());

// hiển thị tổng bình luận
echo $comments_count->total_comments;

// bình luận đã được duyệt
echo $comments_count->approved;

// Bình luận được kiểm duyệt
echo $comments_count->moderated;

// Bình luận spam
echo $comments_count->spam;

// Bình luận đã xóa
echo $comments_count->trash;
// Tổng số thành viên
$vnkings_user = count_users();
echo $vnkings_user['total_users'];

// Số thành viên trong nhóm user
$vnkings_cgroup = count( get_users( array('fields' => array('ID'), 'role' => 'author')));
// Thay author bằng các nhóm: administrator, editor, contributor, subscriber.

Thêm đoạn code bên dưới vào file Functions.php:

function getPostViews($postID){ // hàm này dùng để lấy số người đã xem qua bài viết
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){ // Nếu như lượt xem không có
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0"; // giá trị trả về bằng 0
    }
    return $count; // Trả về giá trị lượt xem
}
function setPostViews($postID) {// hàm này dùng để set và update số lượt người xem bài viết.
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++; // cộng đồn view
        update_post_meta($postID, $count_key, $count); // update count
    }
}

Sau đó ở file single.php các bạn thêm đoạn này để tính view và hiển thị view:

// cộng lượt xem
setPostViews(get_the_ID());

// Hiển thị số lượt xem
getPostViews(get_the_ID());

Thêm đoạn code bên dưới vào file Functions.php:

function the_title_limit($max_char, $more_link_text = '') {
$title = get_the_title();
$title = strip_tags($title);

if (strlen($_GET['p']) > 0) {
echo $title;
echo " …";
}
else if ((strlen($title)>$max_char) && ($espacio = strpos($title, " ", $max_char ))) {
$title = substr($title, 0, $espacio);
$title = $title;
echo $title;
echo " …";
echo "$more_link_text";
}
else {
echo $title;
}
}

Sau đó bạn có thể gọi tiêu đề giới hạn số từ bằng cách dùng:

the_title_limit(20)

Thêm đoạn code bên dưới vào file Functions.php:

function post_word_count() {
global $post;
    $words = str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ) );
    $time = $words/250;
	if ( $time < 1) {
		echo 1;
	} else {
		echo round($time, 1, PHP_ROUND_HALF_UP);
	}
}

Bạn vào file single.php trong theme và hiển thị số từ của bài viết bằng đoạn code này:

echo post_word_count();

Thêm đoạn code bên dưới vào file Functions.php:

add_filter('json_enabled', '__return_false');
add_filter('json_jsonp_enabled', '__return_false');

Thêm đoạn code bên dưới vào file Functions.php:

function vnkings_p_first( $content ) {
	return preg_replace( '/<p([^>]+)?>/', '<p$1 class="vnkings_class">', $content, 1 );
}
add_filter( 'the_content', 'vnkings_p_first' );

Thêm đoạn code bên dưới vào file Functions.php:

function create_custom_post() {
	register_post_type( 'custom-post',
	array(
	'labels' => array(
		'name' => __( 'Custom Post' ),
	),
	'public' => true,
	'hierarchical' => true, 
	'has_archive' => true,
	'supports' => array(
		'title',
		'editor',
		'excerpt',
		'thumbnail'
	), 
	'can_export' => true,
	'taxonomies' => array(
			'post_tag',
			'category'
	)
));
}
add_action('init', 'create_custom_post');

Thêm đoạn code bên dưới vào file Functions.php:

function vnkings_them_pages_from_search() {
	global $wp_post_types;
	$wp_post_types['page']->exclude_from_search = true;
}
add_action( 'init', 'vnkings_them_pages_from_search' );
// Thêm Category cho Attachment
function add_categories_for_attachments() {
	register_taxonomy_for_object_type( 'category', 'attachment' );
}
add_action( 'init' , 'add_categories_for_attachments' );

// Thêm Tag cho Attachment 
function add_tags_for_attachments() {
	register_taxonomy_for_object_type( 'post_tag', 'attachment' );
}
add_action( 'init' , 'add_tags_for_attachments' );

Thêm đoạn code bên dưới vào file Functions.php:

// Tạo kích thước upload mới
add_image_size( 'vnkings_custom-thumbnail', 320, 240, true );

// Hiển thị hình ảnh với kích thước mới vừa thêm
the_post_thumbnail_url('vnkings_custom-thumbnail');

Thêm đoạn code bên dưới vào file Functions.php:

function custom_excerpt_length( $length ) {
	return 30;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Lưu ý: trong đó 30 là độ dài nội dung mô tả cần hiển thị.

Thêm đoạn code bên dưới vào file Functions.php:

function google_fonts() {
	wp_register_style( 'OpenSans', '//fonts.googleapis.com/css?family=Open+Sans:400,600,700,800' );
	wp_enqueue_style( 'OpenSans' );
}
add_action( 'wp_print_styles', 'google_fonts' );

Lưu ý: bạn có thể thay link font google bên trên theo ý của mình.

Thêm đoạn code bên dưới vào file Functions.php:

function custom_login_logo() {
echo '<style>.login h1 a { background-image: url(link_image.jpg) !important; background-size: 234px 67px; width:234px; height:67px; display:block; }</style>';
}
add_action( 'login_head', 'custom_login_logo' );

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'widgets_init', function () {
  unregister_widget( 'WP_Widget_Pages' );
  unregister_widget( 'WP_Widget_Calendar' );
  unregister_widget( 'WP_Widget_Archives' );
  unregister_widget( 'WP_Widget_Links' );
  unregister_widget( 'WP_Widget_Meta' );
  unregister_widget( 'WP_Widget_Search' );
  unregister_widget( 'WP_Widget_Text' );
  unregister_widget( 'WP_Widget_Categories' );
  unregister_widget( 'WP_Widget_Recent_Posts' );
  unregister_widget( 'WP_Widget_Recent_Comments' );
  unregister_widget( 'WP_Widget_RSS' );
  unregister_widget( 'WP_Widget_Tag_Cloud' );
  unregister_widget( 'WP_Nav_Menu_Widget' );
}, 11);

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'after_setup_theme', function () {
  remove_theme_support( 'post-formats' );
  remove_theme_support( 'post-thumbnails' );
  remove_theme_support( 'custom-background' );
  remove_theme_support( 'custom-header' );
  remove_theme_support( 'automatic-feed-links' );
  remove_theme_support( 'html5' );
  remove_theme_support( 'title-tag' );
  remove_theme_support( 'menus' );
}, 11 );

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'admin_init', function () {
  remove_role( 'administrator' );
  remove_role( 'editor' );
  remove_role( 'author' );
  remove_role( 'contributor' );
  remove_role( 'subscriber' );
});

Thêm đoạn code bên dưới vào file Functions.php:

function lovend_redirect(){
$vnkcheck = get_current_user_id();
if( is_admin() && !defined('DOING_AJAX') && ( current_user_can('editor') || current_user_can('author') || current_user_can('subscriber') || current_user_can('contributor') ) ){
    wp_redirect( home_url() );
    exit;
  }
}
add_action('init','lovend_redirect');

Thêm đoạn code bên dưới vào file Functions.php:

function nofollow_vnkings($text)
{
    $return = str_replace('<a', '<a rel="nofollow"', $text);
    return $return;
}
add_filter('the_content', 'nofollow_vnkings');

Thêm đoạn code bên dưới vào file Functions.php:

function vnkings_add_fields_user($profile_fields){
$profile_fields['googleplus'] = 'Google+';
$profile_fields['twitter'] = 'Twitter username';
$profile_fields['facebook'] = 'Facebook profile URL';
return $profile_fields;
}
add_filter('user_contactmethods', 'vnkings_add_fields_user');

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'admin_init' , function () {
  // Bỏ cột trong Post
  add_filter( 'manage_posts_columns', function ( $columns ) {
    unset(
      $columns['cb'],
      $columns['title'],
      $columns['author'],
      $columns['categories'],
      $columns['tags'],
      $columns['comments'],
      $columns['date']
    );
    return $columns;
  });
  
  // Bỏ cột trong Page
  add_filter( 'manage_pages_columns', function ( $columns ) {
    unset(
      $columns['cb'],
      $columns['title'],
      $columns['author'],
      $columns['categories'],
      $columns['tags'],
      $columns['comments'],
      $columns['date']
    );
    return $columns;
  });
});

Thêm đoạn code bên dưới vào file Functions.php:

// Tắt thông báo update wordpress phiên bản mới
add_action( 'after_setup_theme', function () {
  add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
  add_filter( 'pre_option_update_core', '__return_null' );
  add_filter( 'pre_site_transient_update_core', '__return_null' );
}, 1 );

// Tắt thông báo update Plugin
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', '__return_null' );


// Tắt thông báo update các plugin đang bật
add_filter( 'transient_update_plugins', function ( $value = '' ) {
  if ( ( isset( $value->response ) ) && ( count( $value->response ) ) ) {
    $active_plugins = get_option( 'active_plugins' );
    if ( $active_plugins ) {
      foreach( $value->response as $plugin_idx => $plugin_item ) {
        if ( ! in_array( $plugin_idx, $active_plugins ) ) {
          unset( $value->response[$plugin_idx] );
        }
      }
    } else {
      foreach( $value->response as $plugin_idx => $plugin_item ) {
        unset( $value->response );
      }
    }
  }
  return $value;
});

Thêm đoạn code bên dưới vào file Functions.php:

add_filter('media_view_strings', function ( $strings ) {
  $strings['createGalleryTitle'] = null; // Bỏ nút "Create gallery"
  $strings['createPlaylistTitle'] = null; // Bỏ nút "Create Audio Playlist"
  $strings['createVideoPlaylistTitle'] = null; // Bỏ nút "Create Video Playlist"
  $strings['insertFromUrlTitle'] = null; // Bỏ nút "Inset from URL"
  return $strings;
});

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'wp_enqueue_scripts', function () {
   wp_deregister_script( 'jquery' );
   wp_deregister_script( 'wp-embed' );
});

Thêm đoạn code bên dưới vào file Functions.php:

function remove_df_media_vnkings( $sizes) {
    unset( $sizes['thumbnail']);
    unset( $sizes['medium']);
    unset( $sizes['large']);
    return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'remove_df_media_vnkings');

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'init', function () {
 // Bỏ RSD link (Really Simple Discovery)
  remove_action( 'wp_head', 'rsd_link' );
 // Bỏ Wlwmanifest link (Windows Live Writer manifest)
  remove_action( 'wp_head', 'wlwmanifest_link' );
 // Bỏ feeds
  remove_action( 'wp_head', 'feed_links', 2 );
 // Bỏ extra feeds, such as category feeds
  remove_action( 'wp_head','feed_links_extra', 3 );
 // Bỏ displayed XHTML generator
  remove_action( 'wp_head', 'wp_generator' );
 // Bỏ REST API link tag
  remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
  // Bỏ oEmbed discovery links.
  remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
  // Bỏ rel next/prev links
  remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
});

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'admin_init', function () {
  // Bỏ Welcome panel
  remove_action('welcome_panel', 'wp_welcome_panel');
  // Bỏ incoming links metabox
  remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
  // Bỏ plugins metabox
  remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
  // Bỏ WordPress News metabox
  remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
  // Bỏ secondary metabox
  remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
  // Bỏ Quick Draft metabox
  remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
  // Bỏ Recent Drafts metabox
  remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
  // Bỏ Activity metabox
  remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
  // Bỏ At a Glance metabox
  remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
  // Bỏ Activity metabox
  remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
});

Thêm đoạn code bên dưới vào file Functions.php:

add_filter( 'contextual_help', function ( $old_help, $screen_id, $screen ) {
  // Bỏ tất cả Tab trợ giúp
  $screen->remove_help_tabs();
  
  // Tùy chọn bỏ Tab trợ giúp
  $screen->remove_help_tab( 'overview' );
  $screen->remove_help_tab( 'help-navigation' );
  $screen->remove_help_tab( 'help-layout' );
  $screen->remove_help_tab( 'help-content' );
  $screen->remove_help_tab( 'attachment-details' );
  $screen->remove_help_tab( 'managing-pages' );
  $screen->remove_help_tab( 'managing-pages' );
  $screen->remove_help_tab( 'moderating-comments' );
  $screen->remove_help_tab( 'adding-themes' );
  $screen->remove_help_tab( 'customize-preview-themes' );
  $screen->remove_help_tab( 'compatibility-problems' );
  $screen->remove_help_tab( 'adding-plugins' );
  $screen->remove_help_tab( 'screen-display' );
  $screen->remove_help_tab( 'actions' );
  $screen->remove_help_tab( 'user-roles' );
  $screen->remove_help_tab( 'press-this' );
  $screen->remove_help_tab( 'converter' );
  $screen->remove_help_tab( 'options-postemail' );
  $screen->remove_help_tab( 'options-services' );
  $screen->remove_help_tab( 'site-visibility' );
  $screen->remove_help_tab( 'permalink-settings' );
  $screen->remove_help_tab( 'custom-structures' );
}, 999, 3);

Thêm đoạn code bên dưới vào file Functions.php:

// Bỏ text Trái
add_filter( 'admin_footer_text', function () {
  return '';
}, 999);

// Bỏ text Phải
add_filter( 'update_footer', function () {
 return '';
}, 999);

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'admin_menu', function () {
  // Bỏ Dashboard
  remove_menu_page( 'index.php' );
  // Bỏ Posts
  remove_menu_page( 'edit.php' );
  // Bỏ Posts -> Categories
  remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=category' );
  // Bỏ Posts -> Tags
  remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' );
  // Bỏ Media
  remove_menu_page( 'upload.php' );
  // Bỏ Media -> Library
  remove_submenu_page( 'upload.php', 'upload.php' );
  // Bỏ Media -> Add new media
  remove_submenu_page( 'upload.php', 'media-new.php' );
  // Bỏ Pages
  remove_menu_page( 'edit.php?post_type=page' );
  // Bỏ Pages -> All pages
  remove_submenu_page( 'edit.php?post_type=page', 'edit.php?post_type=page' );
  // Bỏ Pages -> Add new page
  remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' );
  // Bỏ Comments
  remove_menu_page( 'edit-comments.php' );
  // Bỏ Appearance
  remove_menu_page( 'themes.php' );
  // Bỏ Appearance -> Themes
  remove_submenu_page( 'themes.php', 'themes.php' );
  // Bỏ Appearance -> Customize
  remove_submenu_page( 'themes.php', 'customize.php?return=' . urlencode( $_SERVER['REQUEST_URI'] ) );
  // Bỏ Appearance -> Widgets
  remove_submenu_page( 'themes.php', 'widgets.php' );
  // Bỏ Appearance -> Menus
  remove_submenu_page( 'themes.php', 'nav-menus.php.php' );
  // Bỏ Appearance -> Editor
  remove_submenu_page( 'themes.php', 'theme-editor.php' );
  // Bỏ Plugins
  remove_menu_page( 'plugins.php' );
  // Bỏ Plugins -> Installed plugins
  remove_submenu_page( 'plugins.php', 'plugins.php' );
  // Bỏ Plugins -> Add new plugins
  remove_submenu_page( 'plugins.php', 'plugin-install.php' );
  // Bỏ Plugins -> Plugin editor
  remove_submenu_page( 'plugins.php', 'plugin-editor.php' );
  // Bỏ Users
  remove_menu_page( 'users.php' );
  // Bỏ Users -> Users
  remove_submenu_page( 'users.php', 'users.php' );
  // Bỏ Users -> New user
  remove_submenu_page( 'users.php', 'user-new.php' );
  // Bỏ Users -> Your profile
  remove_submenu_page( 'users.php', 'profile.php' );
  // Bỏ Tools
  remove_menu_page( 'tools.php' );
  // Bỏ Tools -> Available Tools
  remove_submenu_page( 'tools.php', 'tools.php' );
  // Bỏ Tools -> Import
  remove_submenu_page( 'tools.php', 'import.php' );
  // Bỏ Tools -> Export
  remove_submenu_page( 'tools.php', 'export.php' );
  // Bỏ Settings
  remove_menu_page( 'options-general.php' );
  // Bỏ Settings -> Writing
  remove_submenu_page( 'options-general.php', 'options-writing.php' );
  // Bỏ Settings -> Reading
  remove_submenu_page( 'options-general.php', 'options-reading.php' );
  // Bỏ Settings -> Discussion
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
  // Bỏ Settings -> Media
  remove_submenu_page( 'options-general.php', 'options-media.php' );
  // Bỏ Settings -> Permalinks
  remove_submenu_page( 'options-general.php', 'options-permalink.php' );
}, 999);

Thêm đoạn code bên dưới vào file Functions.php:

function vnkings_disable_comment_fields( $fields ) {
  unset( $fields['email'] ); // xóa trường Email
  unset( $fields['author'] ); // xóa trường Tên
  unset( $fields['url'] ); // xóa trường Website
  return $fields;
}
add_filter( 'comment_form_default_fields', 'vnkings_disable_comment_fields' );

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'init', function () {
  remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
  remove_action( 'wp_print_styles', 'print_emoji_styles' );
  remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
  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( 'emoji_svg_url', '__return_false' );
  // Tìm gỡ TinyMCE emojis
  add_filter( 'tiny_mce_plugins', function ( $plugins ) {
    if ( is_array( $plugins ) ) {
      return array_diff( $plugins, array( 'wpemoji' ) );
    }
    return array();
  });
});

Thêm đoạn code bên dưới vào file Functions.php:

add_action( 'admin_bar_menu', function ( $admin_bar ) {
	$admin_bar->remove_menu( 'wp-logo' );            // Ẩn WordPress logo
	$admin_bar->remove_menu( 'about' );            // Ẩn about WordPress link
	$admin_bar->remove_menu( 'documentation' );    // Ẩn WordPress documentation link
	$admin_bar->remove_menu( 'support-forums' );   // Ẩn support forums link
	$admin_bar->remove_menu( 'feedback' );         // Ẩn feedback link
	$admin_bar->remove_menu( 'site-name' );          // Ẩn site name menu
	$admin_bar->remove_menu( 'view-site' );        // Ẩn view site link
	$admin_bar->remove_menu( 'updates' );            // Ẩn updates link
	$admin_bar->remove_menu( 'comments' );           // Ẩn comments link
	$admin_bar->remove_menu( 'new-content' );        // Ẩn content link
	$admin_bar->remove_menu( 'my-account' );         // Ẩn user details tab
}, 999);

Thêm đoạn code bên dưới vào file Functions.php:

add_filter( 'show_admin_bar', '__return_false' );

Audio truyện full

phàm nhân tu tiên audio

vũ thần chúa tể audio

thế giới hoàn mỹ audio

vô thượng thần đế audio

vạn cổ thần de audio

tiên nghịch audio