Send users to theme settings right after activation in WordPress

Many users install a new theme and find it looks nothing like the demo, assume it’s broken, and uninstall—without realizing a few settings would make it shine.

Users not knowing how to configure it is on the developer

Many premium WordPress themes add a dedicated settings page, usually under Appearance or as a top-level menu. If users read the docs, configuring is easy—but users (including me) are lazy.

When users don’t know where to set things—or don’t even know the page exists—that’s on the theme developer. Beyond trimming unnecessary options and improving grouping/labels, there’s a solid fix (here’s the key idea):

After activation, jump straight to the theme settings page

Pick one of the three methods below, paste into your theme’s functions.php, and save.

Method 1:

global $pagenow;
if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) {
   // admin.php?page=theme-settings for theme settings
   wp_redirect( admin_url( 'themes.php?page=theme_settings' ) );
}

Method 2:

function cj_redirect_on_activate() {
   header( 'Location: ' . home_url() . '/wp-admin/themes.php?page=theme-settings' );
}
add_action( 'after_switch_theme', 'cj_redirect_on_activate' );

Method 3:

function mv_filter_plugin_actions( $actions, $plugin_file ) {
   static $plugin;
   if (!isset($plugin))
      $plugin = plugin_basename(__FILE__);
   if ($plugin == $plugin_file) {
       $settings = array('settings' => 'Settings');
       $actions = array_merge($settings, $actions);
   }
   return $actions;
}
add_filter( 'after_switch_theme', 'mv_filter_plugin_actions' );

Done—activate and send users straight to the settings screen.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *