How to insert an image as an attachment in the wordpress table "wp_posts" using sql?
I have used php and sql to try to change the already existent IDs with other IDs from the wp_posts
$update = "UPDATE wp_posts SET ID=$id_new WHERE ID=$id_old";
if (mysqli_query($conn, $update)) {
echo "Record updated successfully"."</br>";
} else {
echo "Error updating record: " . mysqli_error($conn)."</br>";
}
I expect id_old (which is the ID of the attachment) to be changed with id_new, but when i access the attachment link, instead of showing the image, it displays the title of the image.