Skip to content

Version 2.0.0: Modern rewrite with Press This 2.x support#26

Merged
kraftbj merged 10 commits intodevelopfrom
claude/press-this-filter-ui-fdxr3
Feb 19, 2026
Merged

Version 2.0.0: Modern rewrite with Press This 2.x support#26
kraftbj merged 10 commits intodevelopfrom
claude/press-this-filter-ui-fdxr3

Conversation

@kraftbj
Copy link
Copy Markdown
Owner

@kraftbj kraftbj commented Feb 4, 2026

**From a Claude Code automomous session - pushing for review - not human reviewed **

Major update providing UI for Press This plugin filters with support for both 1.x and 2.x versions:

  • New React-based settings page using WordPress components
  • Version detection to show appropriate options for installed Press This version
  • Block picker UI for selecting which blocks are available in Press This 2.x
  • Support for all new 2.x filters: allowed blocks, post type, post format, sideload settings, URL proxy
  • Automatic migration of settings from 1.x option names
  • Legacy compatibility layer for seamless upgrades
  • Modular PHP architecture with separate classes for version detection, settings, filters, and legacy compatibility

https://claude.ai/code/session_01XTHYGS1TuXEHaYzrgSYkBs

Major update providing UI for Press This plugin filters with support for both 1.x and 2.x versions:

- New React-based settings page using WordPress components
- Version detection to show appropriate options for installed Press This version
- Block picker UI for selecting which blocks are available in Press This 2.x
- Support for all new 2.x filters: allowed blocks, post type, post format, sideload settings, URL proxy
- Automatic migration of settings from 1.x option names
- Legacy compatibility layer for seamless upgrades
- Modular PHP architecture with separate classes for version detection, settings, filters, and legacy compatibility

https://claude.ai/code/session_01XTHYGS1TuXEHaYzrgSYkBs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a major rewrite of the plugin to introduce a modern React-based settings UI and a modular PHP architecture that supports both Press This 1.x and 2.x filters.

Changes:

  • Adds a React/WordPress-components settings page (with block picker UI) bundled via @wordpress/scripts and a new webpack entry.
  • Refactors PHP into namespaced classes for version detection, settings registration/REST API, legacy option migration, and filter application for both 1.x and 2.x Press This behavior.
  • Updates plugin metadata and readme to 2.0.0, raising minimum WP/PHP requirements and documenting the new feature set and settings location.

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
webpack.config.js Adds a settings entry point so the React admin UI is bundled via @wordpress/scripts.
package.json Introduces build/lint scripts and WordPress JS dependencies to support the new React admin page and tooling.
src/settings/index.js Boots the settings React app into the #press-this-extended-settings container using createRoot.
src/settings/styles.scss Provides scoped styles for the settings page, including block picker layout, notices, and advanced warning styling.
src/settings/components/SettingsPage.js Implements the main settings UI: loads data via custom REST endpoints, renders grouped sections, wires up save behavior, and shows version-aware notices.
src/settings/components/BlockPicker.js Implements the block picker with search, category grouping, bulk selection, and selection counters for Press This 2.x allowed blocks.
includes/class-version-detector.php Detects whether the Press This plugin is present and its major version, exposing a capability list for conditional features.
includes/class-settings.php Defines all plugin settings, registers them with the WP Settings API and REST API, exposes supporting endpoints (settings, version, blocks, post types), and enqueues the admin React/CSS assets.
includes/class-legacy-compat.php Migrates legacy 1.x options to the new option keys and cleans up deprecated options, ensuring a smooth upgrade path.
includes/class-filters.php Applies the appropriate Press This filters based on stored options and detected capabilities (media/text discovery, redirects, blocks, post type/format, sideloading, URL proxy).
press-this-extended.php Replaces the monolithic implementation with a singleton main class that wires up translations, settings, filters, legacy compat, and plugin action links, and adds plugin metadata for 2.0.0.
readme.txt Updates metadata, description, feature list, install instructions, screenshots, changelog, and upgrade notice to reflect the 2.0.0 release and new settings UI.
.gitignore Adds ignores for Node modules, logs, IDE artifacts, and temp files while keeping build/ tracked for distribution.
build/.gitkeep Ensures the build/ directory is present in the repo even before assets are generated.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/class-settings.php
Comment thread src/settings/components/BlockPicker.js
Comment thread src/settings/components/SettingsPage.js
Comment thread src/settings/components/SettingsPage.js Outdated
Comment thread src/settings/components/SettingsPage.js
- Replace category header div with button for keyboard accessibility
- Remove unused PanelRow import
- Remove unused setVersion and postTypes state
- Remove donate link from readme.txt
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/settings/components/SettingsPage.js
Comment thread src/settings/index.js
Comment thread src/settings/components/BlockPicker.js Outdated
Comment thread includes/class-settings.php Outdated
Comment thread includes/class-legacy-compat.php
Comment thread includes/class-legacy-compat.php
Comment thread src/settings/components/SettingsPage.js Outdated
Comment thread includes/class-version-detector.php
Comment thread includes/class-settings.php
Comment thread includes/class-legacy-compat.php
Match the minimum version required by Press This itself.
…on detection

- Use PRESS_THIS_EXTENDED_FILE for plugins_url() so assets resolve to
  the plugin root instead of includes/
- Sanitize values through registered callbacks before saving via REST
- Use sentinel defaults in legacy compat so stored false values are not
  confused with missing options
- Check is_plugin_active() in version detector so an installed but
  deactivated Press This does not enable settings
- Replace block row div with label for native keyboard and screen
  reader support
- Capture post-types API response and render post_type setting as a
  SelectControl dropdown instead of a freeform textarea
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/class-version-detector.php
Comment thread src/settings/components/SettingsPage.js
Comment thread includes/class-settings.php
Comment thread readme.txt Outdated
Comment thread press-this-extended.php
Comment thread package.json
Comment on lines +20 to +21
"@wordpress/i18n": "^4.0.0",
"@wordpress/icons": "^9.0.0"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json lists several @wordpress/* runtime dependencies that aren’t imported anywhere in src/ (e.g. @wordpress/block-editor, @wordpress/data, @wordpress/icons). If they aren’t needed, removing them will reduce install size and avoid pulling unused packages into the dependency graph.

Suggested change
"@wordpress/i18n": "^4.0.0",
"@wordpress/icons": "^9.0.0"
"@wordpress/i18n": "^4.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
// Set up API fetch with nonce
apiFetch.use( apiFetch.createNonceMiddleware( nonce ) );
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script registers the nonce middleware unconditionally at module load. If pressThisExtendedSettings isn’t localized (or nonce is undefined), this will still attach middleware and can cause REST requests to fail in unexpected ways. Only register the middleware when a valid nonce is present (or move setup inside the component after confirming the container + localized data exist).

Suggested change
// Set up API fetch with nonce
apiFetch.use( apiFetch.createNonceMiddleware( nonce ) );
// Set up API fetch with nonce (only when a valid nonce is available)
if ( typeof nonce !== 'undefined' && nonce ) {
apiFetch.use( apiFetch.createNonceMiddleware( nonce ) );
}

Copilot uses AI. Check for mistakes.
Button,
CheckboxControl,
SearchControl,
__experimentalText as Text,
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses __experimentalText from @wordpress/components. Experimental exports can change/disappear between WordPress versions, which risks breaking the settings UI. Prefer a stable component (e.g., Text if available in your supported WP versions) or remove the dependency on the experimental export.

Suggested change
__experimentalText as Text,
Text,

Copilot uses AI. Check for mistakes.
Comment on lines +528 to +533
$asset_file = plugin_dir_path( dirname( __FILE__ ) ) . 'build/settings.asset.php';

if ( ! file_exists( $asset_file ) ) {
return;
}

Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin requires built assets (build/settings.js, build/settings.asset.php, build/settings.css) to render the settings UI, but the PR only adds build/.gitkeep. As-is, end users will see an empty settings screen unless they manually run the build. Commit the build artifacts for distribution (or provide a non-build fallback UI).

Copilot uses AI. Check for mistakes.
@kraftbj
Copy link
Copy Markdown
Owner Author

kraftbj commented Feb 10, 2026

@copilot care to do a final review?

Copy link
Copy Markdown

Copilot AI commented Feb 10, 2026

@kraftbj I've opened a new pull request, #27, to work on those changes. Once the pull request is ready, I'll request review from you.

Includes Press This from wordpress.org alongside this plugin,
with WP_DEBUG and SCRIPT_DEBUG enabled.
Move define_settings() from the constructor to a lazy accessor so
__() is not called at plugins_loaded time.  All consumers now go
through get_settings_definitions(), which runs on admin_init or
later hooks where translations are available.
Fixes the Dart Sass legacy JS API deprecation warning and resolves
npm audit vulnerabilities in runtime dependencies.
@kraftbj kraftbj merged commit e64b83c into develop Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants