[wp-trac] [WordPress Trac] #18958: Can't set "Show on screen" for Custom post types

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 20 17:12:39 UTC 2012


#18958: Can't set "Show on screen" for Custom post types
-----------------------------+------------------
 Reporter:  dd32             |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  3.5
Component:  Administration   |     Version:  3.3
 Severity:  normal           |  Resolution:
 Keywords:  has-patch early  |
-----------------------------+------------------
Changes (by nacin):

 * milestone:  Future Release => 3.5


Comment:

 We don't actually need to convert - to _ anymore. We had done that, I'm
 pretty sure, to avoid having hyphens in usermeta, and thus as properties
 for a WP_User object. But WP_User does these checks dynamically with
 has_prop(), `__isset()`, etc.

 All existing screens use - to _, so we might as well keep that. Then we
 just need to handle hyphen support.

 For edit-tags, it calculates the page properly, shows the value in Screen
 Options properly, but saves improperly. For post types, it only calculated
 properly — it showed it and saved it improperly.

 [attachment:18958.3.diff] makes it easy — it passes 'option' to
 add_screen_option() for post types (already there for taxonomies), which
 ensures that the correct option is read from. A logic change in
 set_screen_options() ensures that we only do a hyphen-to-underscore
 conversion when not dealing with a post type or taxonomy. Finally, the
 list tables already properly read from the hyphened post type.

 Only remaining thing is, do we clean up the usermeta table? That would
 require deleting all edit_*_per_page keys where * matched all the
 converted-to-underscore name of any taxonomy or post type with a hyphen in
 it.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18958#comment:34>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list