PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / trunk
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance vtrunk
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | vendor/team-updraft/lib-onboarding-wizard/Wizard/Onboarding/Onboarding.php +17 -1 4.5.2 → trunk View file →
@@ -62,8 +62,10 @@
62 62 if (empty($this->privacy_url_label)) {
63 63 $this->privacy_url_label = __( 'Privacy Statement', 'wp-optimize' );
64 64 }
65 65
66 + $this->maybe_flush_rewrite_rules();
67 +
66 68 add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] );
67 69 add_action( 'wp_ajax_' . $this->prefix . '_onboarding_rest_api_fallback', [ $this, 'rest_api_fallback' ] );
68 70 add_action( 'admin_enqueue_scripts', [ $this, 'maybe_enqueue_onboarding' ] );
69 71 add_action( 'admin_footer', [ $this, 'add_root_html' ] );
@@ -69,8 +71,21 @@
69 71 add_action( 'admin_footer', [ $this, 'add_root_html' ] );
70 72
71 73 }
72 74
75 + /**
76 + * Flush rewrite rules on first onboarding initialization
77 + * As we're registering the rest route conditionally, we need to flush the rewrite rules once.
78 + */
79 + private function maybe_flush_rewrite_rules(): void {
80 + $flushed_option = $this->prefix . '_onboarding_flushed_rewrite_rules';
81 +
82 + if ( ! get_site_option( $flushed_option ) ) {
83 + flush_rewrite_rules();
84 + update_site_option( $flushed_option, time() );
85 + }
86 + }
87 +
73 88 /**
74 89 * Maybe load the plugin wizard, to load on every page of the caller plugin
75 90 *
76 91 * @return void
@@ -268,8 +283,9 @@
268 283 if ($skipped || $completed) {
269 284 delete_site_option( $prefix . '_skipped_onboarding' );
270 285 delete_site_option( $prefix . '_start_onboarding' );
271 286 delete_site_option( $prefix . '_completed_onboarding' );
287 + delete_site_option( $prefix . '_onboarding_flushed_rewrite_rules' );
272 288 return false;
273 289 }
274 290
275 291 // If onboarding is started or in progress or being called via REST
@@ -634,9 +650,9 @@
634 650 wp_localize_script(
635 651 'teamupdraft_onboarding',
636 652 'teamupdraft_onboarding',
637 653 [
638 - 'logo' => $this->logo_path,
654 + 'logo' => esc_url($this->logo_path),
639 655 'prefix' => $this->prefix,
640 656 'plugin_name' => $this->plugin_name,
641 657 'version' => $this->version,
642 658 'steps' => $steps,