Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#45319 closed defect (bug) (fixed)

get_theme_mod() declaration of return type

Reported by: mensmaximus Owned by: pento
Milestone: 5.1 Priority: normal
Severity: normal Version: 4.9.8
Component: Themes Keywords: has-patch
Focuses: docs Cc:


As of WP 4.9.8 get_theme_mod() declares @return string. If you query for navigation menu locations using get_theme_mod('nav_menu_locations') you get back an array. Modern IDEs (like PhpStorm) complain if you start to modify this array because they expect a string. The return value should be changed to mixed.

Attachments (1)

theme.patch (344 bytes) - added by mensmaximus 3 years ago.

Download all attachments as: .zip

Change History (5)

3 years ago

#1 @mensmaximus
3 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
3 years ago

  • Component changed from General to Themes
  • Focuses docs added
  • Milestone changed from Awaiting Review to 5.1
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @pento
3 years ago

  • Owner changed from SergeyBiryukov to pento
  • Status changed from reviewing to accepted

#4 @pento
3 years ago

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

In 44613:

Docs: Correct the @return type of get_theme_mod().

This now matches the type of the $value parameter of set_theme_mod().

Props mensmaximus.
Fixes #45319.

Note: See TracTickets for help on using tickets.