Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

Unchecking core fields like post_title or post_content in the settings UI caused them to disappear permanently, preventing users from re-enabling them.

Root cause: The available fields list only included fields marked as indexable in saved settings or discovered as post meta. Core WordPress fields that were unchecked became invisible.

Changes

Added get_core_fields() method to define fields that must always be available:

  • post_title, post_content, post_excerpt
  • post_date, post_modified (already protected)
  • post_author, permalink

Updated field discovery in two locations:

  1. WPLoupe_Settings_Page::get_available_fields() - Settings page field list now starts with core fields
  2. WP_Loupe_REST::handle_post_type_fields_request() - REST endpoint returns core fields first
private function get_core_fields() {
    return [
        'post_title'    => true,
        'post_content'  => true,
        'post_excerpt'  => true,
        'post_date'     => true,
        'post_modified' => true,
        'post_author'   => true,
        'permalink'     => true,
    ];
}

Core fields now remain in the UI with checkboxes unchecked, allowing users to toggle them without losing access.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/d95a9d895352c30f47604ad1b825ab8fa9d1a373
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/Toflar/state-set-index/zipball/c374bc1efd56a91a547c8dfdc3facbfa09e1b295
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/antecedent/patchwork/zipball/8b6b235f405af175259c8f56aea5fc23ab9f03ce
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/doctrine/dbal/zipball/1a2fbd0e93b8dec7c3d1ac2b6396a7b929b130dc
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/hamcrest/hamcrest-php/zipball/f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/joomla-framework/string/zipball/da2329e05f1f5fc98b709f8638f279513bcd1108
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/loupe-php/loupe/zipball/1fc08816d475d2972ee13da0d55d90abac2081cb
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/loupe-php/matcher/zipball/298d7855200f4d7e45bea3165c3c64753689354c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/mjaschen/phpgeo/zipball/7cd19b96d3626a16c9045bec784eb3f8ab72b976
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/nitotm/efficient-language-detector/zipball/f7f999d8bfd7e4aaf3fb1cf4ba8ca91ea9bbddab
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/47e34210757a2f37a97dcd207d032e1b01e64c7a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wamania/php-stemmer/zipball/d96509294ea843b4b86e4900df27424a6ea0ace8
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mcvZg0 /usr/bin/composer install --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Unchecking core fields from settings hides them permanently</issue_title>
<issue_description>I was testing the weighting and sorting features and decided to uncheck content and/or post title for some post types. After page refresh, those settings are no longer visible so I can't get them back.

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 11, 2025 16:20
Add get_core_fields() method to ensure core fields like post_title,
post_content, post_excerpt, etc. are always available in the settings UI,
even when unchecked. This prevents fields from becoming permanently hidden.

- Updated get_available_fields() in class-wp-loupe-settings.php
- Updated handle_post_type_fields_request() in class-wp-loupe-rest.php
- All existing tests pass

Co-authored-by: soderlind <1649452+soderlind@users.noreply.github.com>
Co-authored-by: soderlind <1649452+soderlind@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with hidden core fields after unchecking settings Fix: Ensure core WordPress fields remain visible when unchecked in settings Nov 11, 2025
Copilot AI requested a review from soderlind November 11, 2025 16:25
- Updated version numbers in `composer.json`, `package.json`, `readme.txt`, and `wp-loupe.php` to 0.5.7.
- Added new entries in `CHANGELOG.md` for version 0.5.7:
  - Always expose core WordPress fields in REST field discovery and settings UI.
  - Changed field discovery to prioritize core fields for consistent UI.
  - Fixed a typo in the previous changelog entry.
@soderlind soderlind marked this pull request as ready for review November 11, 2025 17:39
@soderlind soderlind merged commit cdf66fd into main Nov 11, 2025
3 checks passed
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.

Unchecking core fields from settings hides them permanently

2 participants