| @@ -16,10 +16,10 @@ | ||
| 16 | 16 | use LearnPress\Services\SetupDemoCourseService; |
| 17 | 17 | use LP_Emails; |
| 18 | 18 | use LP_Helper; |
| 19 | 19 | use LP_Request; |
| 20 | -use LP_Settings; | |
| 21 | 20 | use LP_Settings_Cache; |
| 21 | +use LP_Setup_Wizard; | |
| 22 | 22 | use Throwable; |
| 23 | 23 | |
| 24 | 24 | defined( 'ABSPATH' ) || exit; |
| 25 | 25 | |
| @@ -152,8 +152,11 @@ | ||
| 152 | 152 | * |
| 153 | 153 | * @return void |
| 154 | 154 | */ |
| 155 | 155 | protected function save_pages() { |
| 156 | + // LP_Setup_Wizard is only loaded in admin context, so need include here to use. | |
| 157 | + include_once LP_PLUGIN_PATH . 'inc/admin/class-lp-setup-wizard.php'; | |
| 158 | + | |
| 156 | 159 | $page_keys = array( |
| 157 | 160 | 'courses_page_id', |
| 158 | 161 | 'instructors_page_id', |
| 159 | 162 | 'single_instructor_page_id', |
| @@ -166,9 +169,9 @@ | ||
| 166 | 169 | foreach ( $page_keys as $page_key ) { |
| 167 | 170 | $option_key = 'learn_press_' . $page_key; |
| 168 | 171 | $page_id = (int) get_option( $option_key ); |
| 169 | 172 | if ( ! $page_id || 'publish' !== get_post_status( $page_id ) ) { |
| 170 | - $page_id = (int) \LP_Setup_Wizard::instance()->create_page( $page_key ); | |
| 173 | + $page_id = (int) LP_Setup_Wizard::instance()->create_page( $page_key ); | |
| 171 | 174 | if ( $page_id ) { |
| 172 | 175 | update_option( $option_key, $page_id ); |
| 173 | 176 | } |
| 174 | 177 | } |