Skip to content

Hotfix 1.2.12 — fatal error in the Portfolio widget blanks the front page - #42

Merged
puikinsh merged 2 commits into
masterfrom
hotfix/1.2.12-portfolio-fatal
Aug 11, 2026
Merged

Hotfix 1.2.12 — fatal error in the Portfolio widget blanks the front page#42
puikinsh merged 2 commits into
masterfrom
hotfix/1.2.12-portfolio-fatal

Conversation

@puikinsh

Copy link
Copy Markdown
Member

Regression from 1.2.11. The live demo is currently affected: https://colorlibhub.com/shapely/ renders only down to the first project, then stops — no footer, no scripts, so the slider, icons and images below that point never appear.

Cause

wp_get_post_terms() returns a WP_Error when jetpack-portfolio-type is not a registered taxonomy — which is the case whenever Jetpack (or whatever supplied the portfolio post type) is deactivated while portfolio posts remain in the database.

! empty() is true for an object, so the existing guard passed and implode() got the WP_Error:

PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be
of type ?array, WP_Error given
  in inc/widgets/class-shapely-home-portfolio.php:122

Output stops at exactly that line. Everything below — including wp_footer() and every enqueued script — is never emitted.

Why now

This fault is older than 1.2.11, but was unreachable. The widget registration fix in 1.2.11 means the Portfolio widget now registers on setups where the previous, broken Jetpack::is_module_active() check had silently suppressed it — and that suppression was masking this.

Confirmed by reverting only the gate on a reproduction of the demo's state:

old gate (1.2.10)   HTTP 200   widget not rendered   0 fatals
new gate (1.2.11)   HTTP 500                         1 fatal

I introduced the exposure. The underlying bug was pre-existing.

Fix

  1. is_wp_error() check on the terms result before use.
  2. Portfolio and Testimonials widgets return early when their post type is not registered. WP_Query does not validate post_type, so it was returning rows straight from the database and rendering items with broken taxonomy, permalinks and archive links.

Verified

Reproduced the demo's exact state locally (portfolio posts present, jetpack_portfolio option set, taxonomy unregistered) on WordPress 7.0.3 / PHP 8.5:

State Before After
Post type absent HTTP 500, page truncated, 0 footer scripts HTTP 200, complete page, section correctly omitted
Post type present HTTP 200, section renders normally

Front-end sweep after the fix: all pages complete, jQuery.fn.flexslider / owlCarousel / parallax and ShapelyAdminObject all present, 0 PHP notices, 0 JS errors.

Also worth fixing separately: the theme has the same unguarded pattern in inc/class-shapely-related-posts.php — not fatal there, but it pushed a WP_Error into a tax_query.

🤖 Generated with Claude Code

…tered

The front page of a site using the Portfolio section renders only down to the
first project and then stops: no footer, no scripts, half the page missing.

wp_get_post_terms() returns a WP_Error when 'jetpack-portfolio-type' is not a
registered taxonomy, which is the case whenever Jetpack -- or whatever else
supplies the portfolio post type -- is deactivated while portfolio posts
remain in the database. ! empty() is true for an object, so the guard passed
and implode() received the WP_Error:

  PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must
  be of type ?array, WP_Error given
  in inc/widgets/class-shapely-home-portfolio.php:122

Output stops at exactly that point, which is why the page appears to lose its
slider, icons and images: none of the footer assets are ever emitted.

This became reachable in 1.2.11. The widget registration fix in that release
means the Portfolio widget now registers on setups where the previous, broken
Jetpack::is_module_active() check had silently suppressed it -- and that
suppression had been masking this fault. Confirmed by reverting only the gate:
with the old gate the page returns 200, with the new gate it returns 500.

Two changes:

- The terms result is checked with is_wp_error() before use.
- The Portfolio and Testimonials widgets return early when their post type is
  not registered. WP_Query does not validate post_type, so it was happily
  returning rows straight out of the database and rendering items whose
  taxonomy, permalinks and archive links were all broken.

Verified against both states on WordPress 7.0.3 / PHP 8.5: with the post type
absent the page completes with the section correctly omitted, and with it
present the section renders as before. No fatals in either.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
phpcodesniffer-composer-installer is a Composer plugin, and current Composer
refuses to execute plugins that are not explicitly allow-listed. The require
therefore aborted with "contains a Composer plugin which is blocked by your
allow-plugins config" before PHPCS was ever installed, so the job failed on
infrastructure rather than on anything in the code.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@puikinsh
puikinsh merged commit 6b527bf into master Aug 11, 2026
10 checks passed
@puikinsh
puikinsh deleted the hotfix/1.2.12-portfolio-fatal branch August 11, 2026 07:25
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.

1 participant