[wp-trac] [WordPress Trac] #26466: class-wp-posts-list-table.php : prepare_items() - Is $post_type global?
WordPress Trac
noreply at wordpress.org
Fri Dec 6 23:04:32 UTC 2013
#26466: class-wp-posts-list-table.php : prepare_items() - Is $post_type global?
--------------------------+-----------------------------
Reporter: tivnet | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.7.1
Severity: normal | Keywords:
--------------------------+-----------------------------
I had a weird error on this line in wp-admin/edit.php:
{{{
add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20,
'option' => 'edit_' . $post_type . '_per_page' ) );
}}}
`$post_type` was as array, having 3 post types in it.
I was sorting posts by tag.
In attempt to trace this var (which is kind of global in edit.php), I came
down to the `prepare_items()`.
There, we have
`$post_type = $this->screen->post_type;`
and it's not clear to me whether it should be a local or global variable.
However, when I made it global:
`global $avail_post_stati, $wp_query, $per_page, $mode, $post_type;`
the error has gone.
The related change in code was 19/09/12 (ryan):
Revision 21914: Reduce reliance on global variables in the list tables.
Allow passing a screen ID to the list tables so that ajax handlers can set
the needed screen. Props nacin fixes #21871
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26466>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list