Skip Navigation

[Resolved] Best way to attach images to custom posts?

This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#1204997

BV

Hi!

I have places custom posts and, of course, I have photos of them. Initially I created fields for images. But I'm importing data from my old CMS (non-WP) and I use ultimate WP importer. Actually they don't support importing images for custom post fields, but allow importing of featured image. But I want images to be also attached to their posts to easy delete them with posts (I will have unique images for each posts which I'll not use at other posts and there are plugins which allow to delete posts with attached media). As I see by fast check ability to attach images to any posts is the standard WP feature. So I have a question: why I need toolset image field at all?

#1205503

Hi Maxim,

Thank you for contacting us and I'll be happy to assist.

For better understanding, I'll split your message into two parts:

>> But I want images to be also attached to their posts to easy
>> delete them with posts (I will have unique images for each
>> posts which I'll not use at other posts and there are plugins
>> which allow to delete posts with attached media).

- By default, WordPress doesn't automatically delete the featured images and the attached images, when the relevant post is deleted.

To achieve this, you'll need to use some third-party plugin or custom code.

>> As I see by fast check ability to attach images to any posts is
>> the standard WP feature. So I have a question: why I need
>> toolset image field at all?

- The benefit of using the Toolset's image field is that you'll have the flexibility to call them in your content templates or views, using the visual interface, shortcode or through fields API:
https://toolset.com/documentation/customizing-sites-using-php/functions/

Without it, you'll be limited to use WordPress built-in PHP functions and shortcodes to get the values of those images.

Another benefit is that you can use the image fields in front-end forms if your website needs to have a feature where visitors can upload posts and images from the front-end.
https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1210437

BV

My issue is resolved now. Thank you!