Make WordPress Core

Opened 8 years ago

Closed 7 weeks ago

Last modified 7 weeks ago

#41980 closed enhancement (invalid)

show_in_menu doesn't work with int value

Reported by: truongwp's profile truongwp Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: has-patch
Focuses: administration Cc:

Description

The show_in_menu parameter in register_post_type() function doesn't work with int value (or some other value which be treated as true if convert to boolean). I tried to use 1 instead of true, some other parameters work except show_in_menu. The problem is WordPress use Not Identical operator instead of Not Equal to check the value of show_in_menu when render admin menu items.

Attachments (1)

41980.diff (666 bytes) - added by truongwp 8 years ago.

Download all attachments as: .zip

Change History (5)

@truongwp
8 years ago

#1 @truongwp
8 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


7 weeks ago

#3 @SirLouen
7 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Type changed from defect (bug) to enhancement

According to the docs, show_in_menu only accepts bool or string. int values are not accepted and I can't see a reason of why they should be accepted.

If you can provide an use case on where switch to int could be valuable, maybe this could be reconsidered, but just asking to change for the sake of changing it its not a great idea.

I'm closing this as invalid. Feel free to reopen it, if you happen to have a use case to better showcase the need of this improvement

#4 @SirLouen
7 weeks ago

  • Version changed from 4.9 to 3.1

By the way this was introduced first [15844]/#14145 not in 4.9

Note: See TracTickets for help on using tickets.