I want add update services when I activate my theme, how to do this ? with an hook like enable_update_services_configuration ?
Thanks in advance
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI want add update services when I activate my theme, how to do this ? with an hook like enable_update_services_configuration ?
Thanks in advance
Themes don't currently have activation/deactivation/installation/uninstallation hooks.
Your best bet is to "fake" it somehow, perhaps with a function that only executes one time, based on a switch that gets toggled when the function executes. e.g.:
<?php
function wpse45817_theme_activation() {
// globalize our switch
global $wpse45817_theme_activation_switch;
// Check to see if the switch is set
if ( isset( $wpse45817_theme_activation_switch ) ) {
return;
} else {
// EXECUTE YOUR THEME-ACTIVATION CODE HERE
//
//
// Toggle Theme activation switch
$wpse45817_theme_activation_switch = true;
}
}
add_action( 'after_setup_theme', 'wpse45817_theme_activation' );
?>