Skip to content

Stop page widgets listing every page when none is selected - #92

Open
deepench wants to merge 1 commit into
developfrom
fix/empty-page-widgets
Open

deepench wants to merge 1 commit into
developfrom
fix/empty-page-widgets

Conversation

@deepench

@deepench deepench commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Fixes themegrill/accelerate-pro#55

Changes proposed in this Pull Request:

An Image Services or Recent Work widget with no pages selected listed every published page, including Cart, Checkout and My account. Both widgets drop empty selections and pass what is left as post__in; with nothing selected that is an empty array, which WP_Query treats as no filter, and posts_per_page => -1 then returns every page. Image Services now renders nothing when no page is selected, returning before the widget wrapper is printed (so there is no stray empty wrapper). Recent Work has an optional title and description above the pages, so it keeps those and just matches no pages. Widgets with at least one page selected are unchanged. Pro Image Services was not affected (it passes empty strings, which match nothing), and the Pro Recent Work fix is in the matching accelerate-pro PR.

Verified live by rendering the real widgets with nothing selected: Image Services went from listing all five pages to rendering nothing; Recent Work with a title and description went from five pages to none while keeping the title and text; with one page selected both still render that page.

How to test the changes in this Pull Request:

  1. Add the TG: Image Services widget to a sidebar and leave all page selectors empty, then save.
  2. View a page showing that sidebar and confirm nothing is rendered for the widget.
  3. Select one page and confirm only that page shows.
  4. Do the same with TG: Featured Widget (Recent Work), with a title set, and confirm the title and description show with no pages listed.

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (modification of the currently available functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Other information:

  • Have you added an explanation of what your changes do and why you would like us to include them?
  • Have you successfully ran tests with your changes locally?
  • Have you updated the documentation accordingly?

Changelog entry

Fix - Image Services and Recent Work widgets no longer list every page when none is selected.

With no pages chosen, the Image Services and Recent Work widgets passed an
empty array as post__in. WP_Query treats that as no filter, so with
posts_per_page set to -1 the widget printed every published page,
including Cart, Checkout and My account. Image Services now renders
nothing when no page is selected. Recent Work keeps its title and text and
simply lists no pages. Widgets with at least one page selected are
unchanged.

Verified live: an unconfigured Image Services widget listed all five
pages before and rendered nothing after; an unconfigured Recent Work with
a title kept the title and text and went from five pages to none; with
one page selected both still render that page.
@deepench deepench added the bug label Oct 1, 2026
@tg-autopilot
tg-autopilot requested a lite review from Copilot October 1, 2026 06:24
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

QA suite — refused, no regression spec

This PR changes product source but adds no spec, so the suite was
refused before booting WordPress — running it just to report the same
thing at the end costs runner minutes for nothing. Run
/claudegrill:verify-fix locally and let write-spec add the guard
to this branch, then push again.

Source files changed with no matching spec
inc/widgets/accelerate-image-service-widget.php
inc/widgets/accelerate-recent-work-widget.php

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The reviewed changes address the empty-selection behavior without unresolved issues.

Review effort: Lite
Findings: None

What changed in this PR

Fixes Image Services and Recent Work widgets displaying every page when no page is selected.

Changes:

  • Suppresses Image Services output for empty selections.
  • Prevents Recent Work from querying unfiltered pages while preserving title and description.
File Description
inc/​widgets/​accelerate-recent-work-widget.php Prevents unfiltered queries for empty selections.
inc/​widgets/​accelerate-image-service-widget.php Skips rendering when no pages are selected.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@deepench
deepench requested a review from subin-shk October 1, 2026 06:27
@deepench deepench self-assigned this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants