[wp-trac] [WordPress Trac] #13354: wp_insert_pos not working correctly

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 1 19:04:42 UTC 2010


#13354: wp_insert_pos not working correctly
----------------------------------------------------------+-----------------
 Reporter:  christian_gnoth                               |        Owner:          
     Type:  defect (bug)                                  |       Status:  reopened
 Priority:  high                                          |    Milestone:          
Component:  General                                       |      Version:  2.9.2   
 Severity:  major                                         |   Resolution:          
 Keywords:  wp_insert_post, post_content, 255 characters  |  
----------------------------------------------------------+-----------------
Changes (by christian_gnoth):

  * status:  closed => reopened
  * resolution:  invalid =>


Comment:

 hi,
 here is an example:

 {{{
  $query = "SELECT * FROM basic_pages ORDER BY page_id ";
   set_time_limit(25);
   $result = mysql_query($query, $CON);
   if ( !$result )
     echo mysql_error();

   $wp_pages = array();

   $vac_wp_tb_prefix = get_option('vac_wp_tb_prefix');

   $today = date("Y-m-d H:i:s");
   $insert_count = 0;
   while($R = mysql_fetch_array($result))
   {
     set_time_limit(25);

     $array = array(
         "post_author" => $user_id,
         "post_parent" => intval(0),
         "post_date" => $today,
         "post_date_gmt" => $today,
         "post_modified" => $today,
         "post_modified_gmt" => $today,
         "post_title"=>$R['page_title'],
         "post_status"=>"publish",
         "comment_status"=>"open",
         "ping_status"=>"open",
         "post_name" => sanitize_title($R['page_title']),
         "post_type" => "page"
       );

     $array["post_content"] = $R["page_text"];

     // Content Filter
     $array["post_content"] =
 str_replace('src="images/','src="/images/',$array["post_content"]);

 wp_insert_post( $array );

 }}}

 1. the function do not inserts the complete data. for example a string
 like:

 "><a onclick="window.open('https://www.paypal.com/us/cgi-
 bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-
 outside','olcwhatispaypal','toolbar=no, location=no, directories=no,
 status=no, menubar=no, scrollbars=yes, resizable=yes, width=400,
 height=350');" href="#">

 is short cut to

 "><a href="#">

 it cuts off the string after 255 characters

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


More information about the wp-trac mailing list