WordPress.org

Make WordPress Core

Opened 15 months ago

Closed 14 months ago

Last modified 14 months ago

#51296 closed enhancement (fixed)

Return result of set_theme_mod

Reported by: latifi Owned by: SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: Cc:

Description

Return result of set_theme_mod to handle errors

Attachments (1)

51296.diff (677 bytes) - added by Hareesh Pillai 14 months ago.
Patch refreshed

Download all attachments as: .zip

Change History (7)

This ticket was mentioned in PR #529 on WordPress/wordpress-develop by rezza007.


15 months ago

  • Keywords has-patch added

#2 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 5.6
  • Owner changed from latifi to SergeyBiryukov
  • Status changed from assigned to reviewing

@Hareesh Pillai
14 months ago

Patch refreshed

#3 follow-up: @Hareesh Pillai
14 months ago

Hi @latifi, welcome to Trac. Thanks for the ticket and PR.

I have refreshed the patch in 51296.diff. Also updated @return in the doc block.
Should we also update the remove_theme_mod function?

#4 @SergeyBiryukov
14 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 49214:

Themes: Add a return value to set_theme_mod() to allow for error handling.

Props latifi, hareesh-pillai.
Fixes #51296.

#5 in reply to: ↑ 3 @SergeyBiryukov
14 months ago

Replying to Hareesh Pillai:

I have refreshed the patch in 51296.diff. Also updated @return in the doc block.

Thanks for the refresh!

Should we also update the remove_theme_mod function?

Just noting that this seemed like a good idea, but turned out a bit more complicated, as there are a couple of scenarios where it returns null:

  • If the theme mod was not set.
  • If it was the last remaining theme mod for the theme.

So adding a return value to remove_theme_mod() could be explored in a new ticket if someone feels strongly about it :)

Last edited 14 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.