From da502166c0e12e351c3f792749d793bb90630d98 Mon Sep 17 00:00:00 2001
From: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
Date: Wed, 12 Mar 2025 18:09:39 +0200
Subject: [PATCH 1/2] Move plugin Settings page under Parse.ly menu
---
src/UI/class-dashboard-page.php | 4 ++--
src/UI/class-settings-page.php | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/UI/class-dashboard-page.php b/src/UI/class-dashboard-page.php
index 4ae3eb05b8..1b8c040052 100644
--- a/src/UI/class-dashboard-page.php
+++ b/src/UI/class-dashboard-page.php
@@ -180,7 +180,7 @@ public function add_dashboard_page_to_menu(): void {
'Parse.ly Settings',
'Settings',
Parsely::CAPABILITY, // phpcs:ignore WordPress.WP.Capabilities.Undetermined
- 'parsely-dashboard-page#/settings',
+ Parsely::MENU_SLUG,
'__return_null'
);
}
@@ -261,7 +261,7 @@ public function enqueue_dashboard_page_scripts( ?string $hook_suffix ): void {
if ( $this->parsely->site_id_is_set() ) {
wp_add_inline_script(
- 'parsely-dashboard-page',
+ 'parsely-dashboard-page',
'window.wpParselySiteId = ' . wp_json_encode( $this->parsely->get_site_id() ) . ';',
'before'
);
diff --git a/src/UI/class-settings-page.php b/src/UI/class-settings-page.php
index 51ddeeedf6..e5ea717452 100644
--- a/src/UI/class-settings-page.php
+++ b/src/UI/class-settings-page.php
@@ -150,6 +150,8 @@ public function __construct( Parsely $parsely ) {
*/
public function run(): void {
add_action( 'admin_menu', array( $this, 'add_settings_sub_menu' ) );
+ // Show the plugin's settings page only under the Parse.ly menu.
+ add_action( 'admin_head', array( $this, 'remove_settings_sub_menu' ) );
add_action( 'admin_init', array( $this, 'initialize_settings' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_settings_assets' ) );
}
@@ -206,6 +208,16 @@ public function add_settings_sub_menu(): void {
}
}
+ /**
+ * Removes the plugin's Settings page from the WordPress Settings menu,
+ * while still keeping the page available through its slug/URL.
+ *
+ * @since 3.18.0
+ */
+ public function remove_settings_sub_menu(): void {
+ remove_submenu_page( 'options-general.php', Parsely::MENU_SLUG );
+ }
+
/**
* Adds the help tab to the settings page.
*
From 7996a31203b09ae60e1caa7a7fccbbc32629690d Mon Sep 17 00:00:00 2001
From: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
Date: Wed, 12 Mar 2025 18:41:01 +0200
Subject: [PATCH 2/2] Update hardcoded Settings page URLs
---
src/UI/class-site-health.php | 2 +-
src/content-helper/common/class-content-helper-feature.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/UI/class-site-health.php b/src/UI/class-site-health.php
index dfaee2620c..670d024418 100644
--- a/src/UI/class-site-health.php
+++ b/src/UI/class-site-health.php
@@ -84,7 +84,7 @@ public function check_site_id( array $tests ): array {
if ( $this->parsely->site_id_is_missing() ) {
$result['status'] = 'critical';
$result['label'] = __( 'You need to provide the Site ID', 'wp-parsely' );
- $result['actions'] = __( 'The site ID can be set in the Parse.ly Settings Page.', 'wp-parsely' );
+ $result['actions'] = __( 'The site ID can be set in the Parse.ly Settings Page.', 'wp-parsely' );
}
return $result;
diff --git a/src/content-helper/common/class-content-helper-feature.php b/src/content-helper/common/class-content-helper-feature.php
index dae656c782..ba872ce403 100644
--- a/src/content-helper/common/class-content-helper-feature.php
+++ b/src/content-helper/common/class-content-helper-feature.php
@@ -207,7 +207,7 @@ protected function get_credentials_not_set_message(): string {
'Existing Parse.ly customers can enable this feature by setting their Site ID and API Secret in ',
'wp-parsely'
) . '
- ' .
+ ' .
__( 'wp-parsely options.', 'wp-parsely' ) . '