diff --git a/inc/Admin.php b/inc/Admin.php
index 2c17cd4..79b781e 100644
--- a/inc/Admin.php
+++ b/inc/Admin.php
@@ -29,6 +29,9 @@ public function __construct() {
\add_action( 'admin_head', array( __CLASS__, 'admin_nav_style' ) );
/* Add runtime for data store */
\add_filter( 'newfold_runtime', array( __CLASS__, 'add_to_runtime' ) );
+ /* Add redirect from old url */
+ \add_action( 'admin_menu', array( __CLASS__, 'old_admin_pages' ) );
+ \add_action( 'admin_init', array( __CLASS__, 'old_admin_redirect' ) );
if ( isset( $_GET['page'] ) && strpos( filter_input( INPUT_GET, 'page', FILTER_UNSAFE_RAW ), 'mojo' ) >= 0 ) { // phpcs:ignore
\add_action( 'admin_footer_text', array( __CLASS__, 'add_brand_to_admin_footer' ) );
@@ -226,4 +229,54 @@ public static function add_brand_to_admin_footer( $footer_text ) {
$footer_text = \sprintf( \__( 'Thank you for creating with WordPress and MOJO.', 'wp-plugin-mojo' ) );
return $footer_text;
}
+
+ /**
+ * Old Mojo Url ids
+ *
+ * @return array
+ */
+ public static function get_old_url_ids() {
+ return array(
+ 'mojo-marketplace',
+ 'mojo-performance',
+ 'mojo-staging',
+ 'mojo-home',
+ 'mojo-hosting-panel',
+ 'mojo-jetpack-connect-bounce',
+ 'mojo-marketplace-page',
+ );
+ }
+
+ /**
+ * Keep dummy links for old admin pages
+ * so we can redirect to the new page.
+ *
+ * @return void
+ */
+ public static function old_admin_pages() {
+ // Add old plugin pages (for redirecting)
+ foreach ( self::get_old_url_ids() as $id ) {
+ \add_menu_page(
+ __( 'MOJO', 'wp-plugin-mojo' ),
+ __( 'MOJO', 'wp-plugin-mojo' ),
+ 'manage_options',
+ $id,
+ false
+ );
+ }
+ }
+
+ /**
+ * Redirect old admin page to new admin page,
+ * only applies on first nav click after update or a bookmark.
+ *
+ * @return void
+ */
+ public static function old_admin_redirect() {
+ global $pagenow;
+ if ( 'admin.php' === $pagenow && in_array( $_GET['page'], self::get_old_url_ids() ) ) {
+ wp_redirect( admin_url( 'admin.php?page=mojo' ) );
+ exit;
+ }
+ }
} // END \MOJO\Admin
diff --git a/languages/wp-plugin-mojo.pot b/languages/wp-plugin-mojo.pot
index 04db75f..ef072c4 100644
--- a/languages/wp-plugin-mojo.pot
+++ b/languages/wp-plugin-mojo.pot
@@ -74,51 +74,53 @@ msgstr ""
msgid "Preview the coming soon landing page"
msgstr ""
-#: inc/Admin.php:58
-#: inc/Admin.php:212
+#: inc/Admin.php:61
+#: inc/Admin.php:215
#: build/3.2.0/index.js:1
msgid "Home"
msgstr ""
-#: inc/Admin.php:61
+#: inc/Admin.php:64
#: build/3.2.0/index.js:1
msgid "Marketplace"
msgstr ""
-#: inc/Admin.php:66
+#: inc/Admin.php:69
#: build/3.2.0/index.js:1
msgid "Performance"
msgstr ""
-#: inc/Admin.php:70
-#: inc/Admin.php:213
+#: inc/Admin.php:73
+#: inc/Admin.php:216
#: build/3.2.0/index.js:1
msgid "Settings"
msgstr ""
-#: inc/Admin.php:73
+#: inc/Admin.php:76
#: build/3.2.0/index.js:1
msgid "Help"
msgstr ""
-#: inc/Admin.php:115
-#: inc/Admin.php:116
+#: inc/Admin.php:118
+#: inc/Admin.php:119
+#: inc/Admin.php:260
+#: inc/Admin.php:261
msgid "MOJO"
msgstr ""
-#: inc/Admin.php:158
+#: inc/Admin.php:161
msgid "Please update to a newer WordPress version."
msgstr ""
-#: inc/Admin.php:159
+#: inc/Admin.php:162
msgid "There are new WordPress components which this plugin requires in order to render the interface."
msgstr ""
-#: inc/Admin.php:160
+#: inc/Admin.php:163
msgid "Please update now"
msgstr ""
-#: inc/Admin.php:226
+#: inc/Admin.php:229
msgid "Thank you for creating with WordPress and MOJO."
msgstr ""