[wp-trac] [WordPress Trac] #21117: Custom post called "content" triggers a PHP notice

WordPress Trac wp-trac at lists.automattic.com
Sat Jun 30 02:25:46 UTC 2012


#21117: Custom post called "content" triggers a PHP notice
----------------------------+------------------------------
 Reporter:  bpierre         |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.4
 Severity:  minor           |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------------------
Changes (by jeremyfelt):

 * keywords:   => has-patch


Comment:

 Confirmed on latest trunk. Looks like two separate, but related, issues
 here.

 First, when the admin menu is built, an ID is auto generated of the
 structure `new-{$post_type}`. The default id for the Add New item in the
 WP Admin bar is `new-content`. When a post type is registered as
 `content`, a conflict appears because that ID already exists. The bigger
 problem is that the Add New menu does not appear at all at this point.

 I would personally assume 'content' is too generic a name to use when
 registering a post type, but perhaps the ID used for the Add New item is
 too generic as well. Prefixing the post type is probably the best answer
 to avoid any other unforseen conflicts.

 Separately from this - The code in `add_node()` detects that a node
 already exists with this ID and grabs the default data associated with it.
 The next line of code attempts to then use `wp_parse_args()` with data it
 has just confirmed was empty, which generates the PHP notice.

 The patch attached (attachment:21117.diff) addresses only the removal of
 `wp_parse_args()` in this scenario.

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


More information about the wp-trac mailing list