Opened 22 months ago
Closed 7 months ago
#18323 closed defect (bug) (fixed)
Screen Options "Show on Screen [n] Posts" for custom post type containing digits in its name does not work
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Post Types | Version: | 3.2.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | wordpress@…, leho@… |
Description
- In a plugin, write the code to register a custom post type called "all_in_1_event", or any other name that contains a digit.
- On the manage screen for that custom post type, reveal the Screen Options.
- Enter a new value for the "Show on Screen [n] Posts" field, something other than the default value of 20.
- Click "Apply".
- Reveal the Screen Options again.
- The new value has not been saved.
It seems to be that this is because of a check that occurs in the set_screen_options() function (misc.php, line 331). The option name is not allowed to contain digits - only letters, dashes and underscores - and I don't understand why. Our custom post type does contain a digit, and it has never been a problem for us before - except for saving the Screen Options.
Attachments (2)
Change History (12)
SergeyBiryukov — 22 months ago
comment:1
SergeyBiryukov — 22 months ago
- Keywords has-patch added
- Cc wordpress@… added
comment:3
SergeyBiryukov — 21 months ago
the glitch is confirmed here too, post type 'feed-posts', perhaps it happens for any post type with a dash in it?
- Component changed from Validation to Post Types
- Milestone changed from Awaiting Review to 3.5
See #21322 for more history. Looks like we should allow whatever sanitize_key() allows here.
Version 0, edited 8 months ago
by nacin
(next)
SergeyBiryukov — 8 months ago
comment:8
SergeyBiryukov — 8 months ago
18323.2.patch uses sanitize_key().
comment:10
ryan — 7 months ago
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [22253]:
Note: See
TracTickets for help on using
tickets.

Related: #18559