0

I'm coding my own custom install.php (wp-content) and I want to be ablt to activate my custom theme when an install is running. Right now I've tried switch_theme('theme-slug') which works, however when I first log in to my admin panel, all the admin pages under Settings etc. is gone, so something is not right. If I remove switch_theme function from my install.php, then it tries to activate "twentyseventeen" however it can't find that theme, and that's because I've removed it from the themes folder, because I want to activate my own theme called "mastertheme".

Can somebody help me on how to activate my own theme when WordPress installs?

  • What pages have you created in your theme means you have index.php and style.css right – Owaiz Yusufi Aug 3 '17 at 13:42
  • can you please attach the screenshot with your question – Owaiz Yusufi Aug 3 '17 at 13:43
1

Twenty Seventeen is the default theme if no default theme has been defined. line 359 from wp-includes/default-constants.php

if ( !defined('WP_DEFAULT_THEME') )
        define( 'WP_DEFAULT_THEME', 'twentyseventeen' );

You do not need to edit that file, however, to change this.

Simply define your theme in the file wp-config.php just before this line:

require_once(ABSPATH . 'wp-settings.php');

Like so:

define( 'WP_DEFAULT_THEME', 'my-new-default-theme' );
require_once(ABSPATH . 'wp-settings.php');
  • Thanks! Can I do that in wp-config-sample? Edit: looks like it, I just tried. – Dueify Aug 4 '17 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.