Các hàm trong WordPress
action hook
add_action( string $hook_name, callable $callback, int $priority = 10, int $accepted_args = 1 ): true
Thêm một hành động vào hook.
Ví dụ 1: Vô hiệu hóa tệp comment-reply.js
function disable_comment_reply_script() {
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_deregister_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'disable_comment_reply_script');
Không load file comment-reply.js