Title: Set default values on theme switch
Last modified: August 24, 2016

---

# Set default values on theme switch

 *  [Mstoic Themes](https://wordpress.org/support/users/mstoic/)
 * (@mstoic)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/set-default-values-on-theme-switch/)
 * Hey,
 * I am a theme developer and I am using the below code to set default options and
   to set my custom template for YARPP on theme switch.
 * function mstoic_theme_switch_function() {
 *  /* STOP YARPP FROM AUTO DISPLAY, SET CUSTOM YARPP TEMPLATE */
    yarpp_set_option(‘
   auto_display’, false); yarpp_set_option(‘use_template’, true); yarpp_set_option(‘
   template_file’, ‘yarpp-template-mstoic.php’);
 * }
 * add_action( ‘after_switch_theme’, ‘mstoic_theme_switch_function’ );
 * But this code is not working as expected.
 * [https://wordpress.org/plugins/yet-another-related-posts-plugin/](https://wordpress.org/plugins/yet-another-related-posts-plugin/)

The topic ‘Set default values on theme switch’ is closed to new replies.

 * ![](https://ps.w.org/yet-another-related-posts-plugin/assets/icon-256x256.png?
   rev=2549977)
 * [YARPP - Yet Another Related Posts Plugin](https://wordpress.org/plugins/yet-another-related-posts-plugin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yet-another-related-posts-plugin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/reviews/)

## Tags

 * [theme development](https://wordpress.org/support/topic-tag/theme-development/)
 * [YARPP](https://wordpress.org/support/topic-tag/yarpp/)

 * 0 replies
 * 1 participant
 * Last reply from: [Mstoic Themes](https://wordpress.org/support/users/mstoic/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/set-default-values-on-theme-switch/)
 * Status: not resolved