The activate_wp_head WordPress PHP action fires before the Site Activation page is loaded, specifically on the wp_head action.
Usage
add_action('activate_wp_head', 'your_custom_function');
function your_custom_function() {
// your custom code here
}
Parameters
- No parameters for this action.
More information
See WordPress Developer Resources: activate_wp_head
Examples
Adding a custom CSS code to the activation page
This code adds a custom CSS code to the activation page.
add_action('activate_wp_head', 'add_custom_css_to_activation_page');
function add_custom_css_to_activation_page() {
echo '<style>body { background-color: #f0f0f0; }</style>';
}
Add a meta tag to the activation page
This code adds a custom meta tag to the activation page.
add_action('activate_wp_head', 'add_meta_tag_to_activation_page');
function add_meta_tag_to_activation_page() {
echo '<meta name="description" content="This is the site activation page.">';
}
Include an external JavaScript file on the activation page
This code includes an external JavaScript file to the activation page.
add_action('activate_wp_head', 'include_js_on_activation_page');
function include_js_on_activation_page() {
echo '<script src="https://example.com/your-custom-script.js"></script>';
}
Add a custom favicon to the activation page
This code adds a custom favicon to the activation page.
add_action('activate_wp_head', 'add_favicon_to_activation_page');
function add_favicon_to_activation_page() {
echo '<link rel="shortcut icon" href="https://example.com/favicon.ico" />';
}
Add a custom Google Analytics tracking code to the activation page
This code adds a Google Analytics tracking code to the activation page.
add_action('activate_wp_head', 'add_ga_tracking_code_to_activation_page');
function add_ga_tracking_code_to_activation_page() {
?>
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>
<?php
}