enter image description here

I need to manually set an attachment in a estate post with custom php.

When it was the wordpress that inserted the image into the media library, this image appears in the post on frontend.

However, when the user inserts this attachment into the database even the url of an existing image, the image does not appear in the post.

enter image description here

How can I solve this?

  • check out the _wp_attachment_metadata row in that table. You would need to change data there as well. However, in general it's not ideal to be changing attachments via the database, if there's any way to avoid changing images this way I suggest you look into that – mrben522 Feb 7 at 14:58
  • @mrben522 so if I do not have the line "_wp_attachment_metadata" the image will not be rendered? – Marcos Vinicius Feb 7 at 15:14
  • yes, you really should be doing this in PHP since that's serialized data. manually changing it is going to be painful – mrben522 Feb 7 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.