已解决!我创建了以下脚本:
<?php
global $wpdb;
$postwp = $wpdb->get_results ( "SELECT ID,post_author,post_title FROM wp_posts WHERE post_status = \'publish\' and post_type = \'post\'" );
$users = $wpdb->get_results ( "SELECT post_id,meta_value FROM wp_postmeta where meta_key = \'id_utente_user\'" );
foreach($postwp as $key1=>$value1)
{
foreach($users as $key2=>$value2)
{
if($value1->post_author==$value2->meta_value)
{
add_post_meta( $value1->ID, \'autore\', $value2->post_id );
}
}
}
?>
我希望它能有用。