When a WordPress user is deleted via the standard wp-admin “Delete User” screen without using the “Attribute content to another user” option to reassign their listings, any hp_listing post still authored by that (now-deleted) user ID becomes orphaned. Visiting one of these orphaned listings triggers a fatal error inside HivePress\Components\Listing::update_listing(), caused by a call to get_display_name() on what appears to be a null vendor/user object.
Separately, I’ve also noticed the affected listing’s card is missing its image specifically on the native HivePress search/grid results page, while the same listing’s image displays correctly on other cards (e.g. a homepage section querying the same listing). I’m not yet certain whether this is related to the same root cause or a separate issue, but I’m including it here in case it’s relevant.
Steps to reproduce
- Create a WordPress user and have them publish at least one
hp_listing - Go to Users → delete (+empty trash) that user via wp-admin, without reassigning their content to another user.
- Visit the listing page that was authored by the deleted user.
- Separately, view that same listing’s card on the native HivePress search/grid results page.
Actual result
On first visit to the listing page, the page fatally crashes with:
Uncaught Error: Call to a member function get_display_name() on null
in /wp-content/plugins/hivepress/includes/components/class-listing.php on line 148
The crash originates inside HivePress\Components\Listing::update_listing(), triggered when the Review Submit Form block renders. Stack trace summary:
Review_Submit_Form::boot()
→ Review::get_review_draft()
→ wp_insert_comment()
→ Hook::update_comment()
→ Review::update_rating()
→ Post::save()
→ Listing::update_listing()
On refreshing the page, the fatal error no longer occurs and the listing page renders normally. However, the listing’s card on the native search/grid results page still fails to display its image, even though the same listing’s image renders correctly elsewhere on the site.
Expected result
The listing page should render correctly on first visit, without crashing, regardless of whether the listing’s author account still exists. The listing’s card should also display its image consistently across all card contexts, including the native search/grid page.
Expexted Fix
Adding a null check before the get_display_name() call in update_listing() should resolve the fatal error. The image issue on the search/grid card may be a separate bug or may share the same root cause.