[wp-trac] [WordPress Trac] #30013: Array to string conversion notice when multiple post types are queried in edit.php

WordPress Trac noreply at wordpress.org
Thu Oct 16 21:37:54 UTC 2014


#30013: Array to string conversion notice when multiple post types are queried in
edit.php
-------------------------------+-----------------------------
 Reporter:  jeremyfelt         |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:
 Severity:  normal             |   Keywords:
  Focuses:  administration     |
-------------------------------+-----------------------------
 In `edit.php`, the requested list table post type is captured as the
 global `$typenow` and then assigned to the global `$post_type`. This
 `$post_type` string is then used to display help tabs, to fire a filter
 for screen options, and as a value for a hidden input.

 If a plugin modifies a query - either accidentally or intentionally - to
 include multiple post types by using `$query->set( 'post_type', array(
 'page', 'my_post_type' );` on `parse_query`, the global `$post_type` is
 then turned into an array through `wp->register_globals()` and an "array
 to string conversion" notice is shown.

 We should probably treat the global `$post_type` separately from the
 string required to make the page display properly.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30013>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list