[wp-trac] [WordPress Trac] #22448: Changeset 22011 corrupts the effect of the the_posts filters
WordPress Trac
noreply at wordpress.org
Wed Nov 14 20:47:50 UTC 2012
#22448: Changeset 22011 corrupts the effect of the the_posts filters
-------------------------------+------------------------------
Reporter: ntm | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: trunk
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Comment (by ntm):
The plugin use the filter hook
{{{
add_filter('the_posts', array(&$podPress, 'the_posts'));
}}}
and calls the function
{{{
function the_posts($input) {
if ( FALSE === is_admin() &&
!$this->settings['compatibilityChecks']['themeTested'] ) {
$this->settings['compatibilityChecks']['themeTested'] =
true;
podPress_update_option('podPress_config',
$this->settings);
}
if(!is_array($input)) {
return $input;
}
foreach($input as $key=>$value) {
$input[$key] = $this->addPostData($value);
}
return $input;
}
}}}
which adds some values.
After applying the filter the data of a post array ({{{$this->posts}}})
looks like
{{{
array (
0 =>
WP_Post::__set_state(array(
'ID' => '6',
'post_author' => '1',
'post_date' => '2012-11-14 16:05:24',
'post_date_gmt' => '2012-11-14 15:05:24',
'post_content' => 'test podcast',
'post_title' => 'wp35_ep',
'post_excerpt' => '',
'post_status' => 'publish',
'comment_status' => 'open',
'ping_status' => 'open',
'post_password' => '',
'post_name' => 'wp35_ep',
'to_ping' => '',
'pinged' => '',
'post_modified' => '2012-11-14 16:05:24',
'post_modified_gmt' => '2012-11-14 15:05:24',
'post_content_filtered' => '',
'post_parent' => '0',
'guid' => 'http://127.0.0.1/wp35en/?p=6',
'menu_order' => '0',
'post_type' => 'post',
'post_mime_type' => '',
'comment_count' => '0',
'filter' => NULL,
'podPressMedia' =>
array (
0 =>
array (
'URI' => 'http://127.0.0.1/wp33en/wp-
content/uploads/2012/10/FF102312.mp3',
'title' => '',
'type' => 'audio_mp3',
'size' => 76292598,
'duration' => '158:57',
'previewImage' => 'http://127.0.0.1/wp35en/wp-
content/plugins/podpress/images/vpreview_center.png',
'dimensionW' => 0,
'dimensionH' => 0,
'rss' => 'on',
'atom' => 'on',
'content_level' => 'free',
'ext' => 'mp3',
'mimetype' => 'audio/mpeg',
'authorized' => true,
),
),
'podPressPostSpecific' =>
array (
'itunes:subtitle' => '##PostExcerpt##',
'itunes:summary' => '##PostExcerpt##',
'itunes:keywords' => '##WordPressCats##',
'itunes:author' => '##Global##',
'itunes:explicit' => 'Default',
'itunes:block' => 'Default',
),
)),
...
}}}
The filter data from the wp_postmeta table. The data is used for multiple
purposes by the plugin e.g to add additional elements to the RSS and ATOM
feeds or to the posts on web page.
The functions which should do this use the global variable $post. But the
new line of code reduces the data to the default key+value pairs.
After the new {{{array_map(...)}}} command the array is this (again):
{{{
array (
0 =>
WP_Post::__set_state(array(
'ID' => '6',
'post_author' => '1',
'post_date' => '2012-11-14 16:05:24',
'post_date_gmt' => '2012-11-14 15:05:24',
'post_content' => 'test podcast',
'post_title' => 'wp35_ep',
'post_excerpt' => '',
'post_status' => 'publish',
'comment_status' => 'open',
'ping_status' => 'open',
'post_password' => '',
'post_name' => 'wp35_ep',
'to_ping' => '',
'pinged' => '',
'post_modified' => '2012-11-14 16:05:24',
'post_modified_gmt' => '2012-11-14 15:05:24',
'post_content_filtered' => '',
'post_parent' => '0',
'guid' => 'http://127.0.0.1/wp35en/?p=6',
'menu_order' => '0',
'post_type' => 'post',
'post_mime_type' => '',
'comment_count' => '0',
'filter' => NULL,
)),
...
}}}
This is also what the array is before the filter hook.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22448#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list