Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51296 closed enhancement (fixed)

Return result of set_theme_mod

Reported by: latifi's profile latifi Owned by: sergeybiryukov's profile 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 4 years ago.
Patch refreshed

Download all attachments as: .zip

Change History (7)

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


4 years ago
#1

  • Keywords has-patch added

#2 @SergeyBiryukov
4 years ago

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

@Hareesh Pillai
4 years ago

Patch refreshed

#3 follow-up: @Hareesh Pillai
4 years 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
4 years 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
4 years 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 4 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.