Support » Plugin: Autoremove Attachments » How autoremove only post body attached images?

  • Resolved moisb

    (@moisb)


    hi guys, i have a custom post type on my site that has: 1 body attached image and 1 featured thumbnail each.
    When deleting such posts, I would like the plugin to remove only the body image of the posts, never the featured image (because some are attached in other posts I don’t want to delete).

    In this case, what would be the custom code to insert into functions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    Hello, Moisb!

    It isn’t possible to ignore featured images at the moment, even via custom code. The available filter is meant to allow developers granular control using rules applied to the parent.

    I could, however, build a custom plugin for you with this behavior. Do you want to keep featured images for all posts, pages, and custom post types, or only for that specific post type?

    If you need to ignore featured images only for a specific post type, I’m going to need its name. You can find this name in the URL, when you press Add New. For example, in the URL below, the name of my post type is “landing-page”.
    https://sandbox.local/wp-admin/post-new.php?post_type=landing-page

    Hi Eusebiu, thanks for answer. My post type is “coupon”. So I would not want to remove the featured image. Because each coupon has a relationship to the store taxonomy, and the featured image of the coupon is the same file from store logo.

    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    Hello, Moisb!

    Here is the custom version of the plugin: https://wetransfer.com/downloads/6af8409c5a06c1c67dc9a027bc89f33920190808184757/3b37e1
    Let me know if it works the way you want!

    working perfectly! thank you very much

    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    You’re welcome! I’m glad I could help! 🙂
    Would you, please, consider leaving a review?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How autoremove only post body attached images?’ is closed to new replies.