內容簡介
GetTerms Cookie Consent & Policies 外掛幫助您在 WordPress 網站中實施 Cookie 同意管理,並直接嵌入法律政策。透過與 GetTerms 帳戶連接,提供合規的自動更新文件及可完全配置的 Cookie 同意橫幅。
【主要功能】
• 連接 GetTerms 合規包,使用唯一的令牌
• 全站嵌入 Cookie 同意小工具或手動整合
• 使用短碼顯示實時更新的法律文件
• 支援多語言的小工具和政策
外掛標籤
開發者團隊
② 後台搜尋「GetTerms Cookie Consent & Policies」→ 直接安裝(推薦)
原文外掛簡介
The GetTerms plugin helps you implement cookie consent management and embed legal policies directly into your WordPress site. It connects with your GetTerms account to provide compliant, auto-updating documents and a fully configurable cookie consent banner.
Features
Connect to your GetTerms Compliance Pack using a unique token.
Embed the Cookie Consent Widget site-wide or via manual integration.
Shortcodes to display live-updated legal documents (Privacy Policy, Terms, AUP, etc.).
Support for multiple languages for both widget and policies.
Usage
Setting Up
Navigate to GetTerms in the WordPress admin menu.
Enter your GetTerms token and save your settings.
Embedding the Cookie Consent Widget
Enable the auto-embed option in plugin settings to insert the consent widget in the <head> tag.
You can also embed manually with the provided script tag for advanced use cases or multilingual configurations.
To ensure proper consent enforcement, embed the script as early as possible in the head section.
If you have manually included other scripts in your <head> the recommendation is to manually embed the GetTerms script above all other scripts, and not use auto-embed
Using Shortcodes
Use the following shortcodes to display your policy documents:
[getterms_privacy_en], [getterms_terms_en], [getterms_aup_en]
[getterms_privacy_fr], [getterms_terms_fr], [getterms_aup_fr]
Additional languages and policies are listed in the plugin settings.
How wp_head and wp_enqueue_script work
WordPress loads styles and scripts in two steps:
1) Registration + enqueue (what you do in PHP)
– You register a script/style and enqueue it using WordPress functions.
– Common hooks:
– wp_enqueue_scripts (front end): enqueue scripts/styles for the theme and plugins.
– admin_enqueue_scripts (wp-admin): enqueue for specific admin screens.
– login_enqueue_scripts (login screen): enqueue for wp-login.php.
2) Output (what WordPress prints into the page)
– WordPress prints the enqueued styles and scripts into the HTML at the proper places, using theme hooks:
– wp_head: prints styles and any head scripts (e.g., those with $in_footer = false).
– wp_footer: prints scripts that were enqueued for the footer (those with $in_footer = true).
In practice, you should enqueue on the correct action, and let WordPress output them on wp_head/wp_footer. Example:
Register and enqueue a script
function myplugin_enqueue_assets() {
wp_register_script(
‘myplugin-frontend’,
plugins_url(‘dist/myplugin.js’, FILE),
array(‘jquery’),
‘1.0.0’,
true // load in footer
);
wp_enqueue_script(‘myplugin-frontend’);
}
add_action(‘wp_enqueue_scripts’, ‘myplugin_enqueue_assets’);
What gets printed where
Because $in_footer = true, the script tag is printed near the end of the page when the theme calls wp_footer().
If $in_footer = false (default), it will be printed in the
How this plugin uses these hooks
– For the Cookie Consent Widget, you can choose between:
– Auto-embed: The plugin hooks into wp_head very early to print the consent script as high as possible in the
– Manual embed: You paste the provided
