WordPress.org

Make WordPress Core

#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:
PR Number:

Description

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 12 months ago.

Download all attachments as: .zip

Change History (5)

@mensmaximus
12 months ago

#1 @mensmaximus
12 months ago

  • Keywords has-patch added

#2 @SergeyBiryukov
12 months 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
10 months ago

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

#4 @pento
10 months 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.