I am adding data to the wordpress with sql.

$sql= "INSERT INTO idiot_posts (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, 
    `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES 
    ('', '2', now(), now(), '', 'placeholder', '', 'inherit', 'open', 'closed', '', 'placeholder', '', '', '', '', '', $icerikid, '$newname', '0', 'attachment', 'image/jpeg', '0')";
    mysql_query($sql, $baglanti);
    $kapakid = mysql_insert_id();

    $sql = "INSERT INTO idiot_postmeta (`meta_id`, `post_id`, `meta_key`, `meta_value`) VALUES ('', $icerikid, '_thumbnail_id', $kapakid)";
    mysql_query($sql, $baglanti);
    echo mysql_error();

These are my codes. I add the data. But featured image does not come. I’m waiting for your help

Thank you from now.

Read more here: WordPress Manually adding data Via Sql


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: