settings_hook = add_submenu_page( 'edit.php?post_type=acmn_docs', __( 'Settings', 'acumenon' ), __( 'Settings', 'acumenon' ), 'manage_options', 'acumenon-settings', [ Settings_Page::get_instance(), 'render' ] ); } public function enqueue_scripts( $hook ) { // Only load our React app on our settings page if ( $hook !== $this->settings_hook ) { return; } $asset_file = ACUMENON_PLUGIN_DIR . 'build/index.asset.php'; if ( file_exists( $asset_file ) ) { $asset = require $asset_file; wp_enqueue_script( 'acumenon-admin', ACUMENON_PLUGIN_URL . 'build/index.js', $asset['dependencies'], $asset['version'], true ); // Load translations for the React app wp_set_script_translations( 'acumenon-admin', 'acumenon', ACUMENON_PLUGIN_DIR . 'languages' ); // Localize script with data for the React app wp_localize_script( 'acumenon-admin', 'acumenonAdminData', [ 'restUrl' => esc_url_raw( rest_url( 'acumenon/v1/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ) ] ); wp_enqueue_style( 'wp-components' ); if ( file_exists( ACUMENON_PLUGIN_DIR . 'build/style-index.css' ) ) { wp_enqueue_style( 'acumenon-admin-style', ACUMENON_PLUGIN_URL . 'build/style-index.css', [ 'wp-components' ], $asset['version'] ); } } } }