[wp-trac] Re: [WordPress Trac] #6882: WordPress Simple Tagging
Import Problem
WordPress Trac
wp-trac at lists.automattic.com
Wed Apr 30 23:03:16 GMT 2008
#6882: WordPress Simple Tagging Import Problem
----------------------------------------+-----------------------------------
Reporter: na3s | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 2.5.2
Component: General | Version: 2.5.1
Severity: critical | Resolution:
Keywords: simple tagging import tags |
----------------------------------------+-----------------------------------
Comment (by na3s):
I cannot locate the source of this issue. Within the function 'tag2post'
the function 'wp_add_post_tags returns' '''false'''. The parameters being
fed into this function are $the_post and $the_tag, both of which seem to
have no errors, and the correct types (an integer and a string). I have a
feeling it may be an error somewhere in the file wp-includes/post.php, but
have no way of verifying this. Below is an alternate tag2post function I
used while attempting to debug this issue; it may be of use to someone.
{{{
function tag2post ( ) {
global $wpdb;
// get the tags and posts we imported in the last 2 steps
$posts = get_option('stpimp_posts');
// null out our results
$tags_added = 0;
//make a pretty scrollable boxy
echo '<div style="height:300px;width:auto;overflow:scroll;">';
// loop through each post and add its tags to the db
foreach ( $posts as $this_post ) {
$the_post = (int) $this_post->post_id;
//$the_post = $this_post->post_id;
$the_tag = $wpdb->escape($this_post->tag_name);
//echo some data about each row.
$wtfoutput =
$tags_added."->|".$the_post."|<em>(".gettype($the_post).")</em>
|".$the_tag."|<em>(".gettype($the_tag).")</em>";
// try to add the tag to a broken function and output a
friendly status message.
if(wp_set_post_tags($the_post, $the_tag, true)) {
$wtfoutput .= ' <strong
style="color:#00ff00;">Success!</strong><br />'."\r\n";
} else {
$wtfoutput .= ' <strong
style="color:#ff0000;">Shitty.</strong><br />'."\r\n";
}
echo $wtfoutput;
$tags_added++;
}
echo "</div>";
// that's it, all posts should be linked to their tags properly,
pending any errors we just spit out!
//it never gets this far, it just hangs and the foreach breaks!
return $tags_added;
}
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/6882#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list