Using WordPress ‘install_theme_complete_actions’ PHP filter

The install_theme_complete_actions WordPress PHP Filter allows you to modify the list of action links that appear after a single theme installation.

Usage

add_filter('install_theme_complete_actions', 'your_custom_function', 10, 4);
function your_custom_function($install_actions, $api, $stylesheet, $theme_info) {
    // your custom code here
    return $install_actions;
}

Parameters

  • $install_actions (string[]): Array of theme action links.
  • $api (object): Object containing WordPress.org API theme data.
  • $stylesheet (string): Theme directory name.
  • $theme_info (WP_Theme): Theme object.

More information

See WordPress Developer Resources: install_theme_complete_actions

Examples

Add a custom action link to the theme installation complete actions.

add_filter('install_theme_complete_actions', 'add_custom_action_link', 10, 4);
function add_custom_action_link($install_actions, $api, $stylesheet, $theme_info) {
    $install_actions['custom_action'] = '<a href="https://your-link.com">Custom Action</a>';
    return $install_actions;
}

Remove the ‘Live Preview’ action link from the theme installation complete actions.

add_filter('install_theme_complete_actions', 'remove_live_preview_link', 10, 4);
function remove_live_preview_link($install_actions, $api, $stylesheet, $theme_info) {
    unset($install_actions['preview']);
    return $install_actions;
}

Change the ‘Activate’ action link URL in the theme installation complete actions.

add_filter('install_theme_complete_actions', 'change_activate_link', 10, 4);
function change_activate_link($install_actions, $api, $stylesheet, $theme_info) {
    $install_actions['activate'] = '<a href="https://your-link.com">Activate</a>';
    return $install_actions;
}

Add a custom action link to the theme installation complete actions based on the theme data.

add_filter('install_theme_complete_actions', 'add_custom_link_based_on_theme_data', 10, 4);
function add_custom_link_based_on_theme_data($install_actions, $api, $stylesheet, $theme_info) {
    if ($theme_info->get('Author') === 'Your Name') {
        $install_actions['custom_action'] = '<a href="https://your-link.com">Custom Action</a>';
    }
    return $install_actions;
}

Rearrange the order of the action links in the theme installation complete actions.

add_filter('install_theme_complete_actions', 'rearrange_action_links', 10, 4);
function rearrange_action_links($install_actions, $api, $stylesheet, $theme_info) {
    $new_order = array(
        'preview' => $install_actions['preview'],
        'activate' => $install_actions['activate'],
        'customize' => $install_actions['customize']
    );
    return $new_order;
}