The customer noticed that users were able to have multiple photos attached to their profiles in the WordPress Admin, even though only one photo should be allowed. He wanted to ensure that if a user removes their profile photo and resubmits the form, the photo is permanently deleted. Additionally, if a user chooses a new photo, it should replace the existing one.
Solution:
We explained that Toolset Forms does not natively support this feature but provided a workaround using custom code:
1- Use the cred_save_data action hook to trigger a PHP function when a user submits the post form.
2- In the PHP function:
• Retrieve images attached to the current post using get_attached_media.
• Access images stored in the custom repeating image field using get_post_meta.
• Compare these sets of images to identify and remove unused files using wp_delete_attachment.
I have created custom post types named "Offers of the day" using WPBakery Page Builder. After publishing a new post, the page appears boxed rather than full-width, and the post metadata is displayed at the top, which cannot be hidden. Adjusting Bootstrap settings in Toolset has not resolved these issues.
Solution:
Use a CSS code snippet to make the page full-width and hide the post metadata by targeting the unique CSS class generated for the custom post type: