Support » Plugin: Attachment Pages Redirect » Gallery under single link redirection

  • Resolved Fanaticweb

    (@fanaticweb)


    Hi Samuel,

    I’m trying out your plugin for a classified themed website, basically users post to sell items and attach images to the post creating their unique gallery per link (the posts are based on custom-taxonomy).

    My main question is:
    Will your plugin be able to redirect the attached images of this post given it has its unique slug/permalink once the post expires (status becomes Draft)?

    If that’s the case, does the plugin work on previously expired posts fetching the now “unattached” images to those expired/deleted posts or is this out of its scope?

    Otherwise, can it handle manually deleted images (By Admin) from those expired posts?

    Thank you and looking forward for your feedback.

    • This topic was modified 9 months ago by Fanaticweb.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Samuel Aguilera

    (@samuelaguilera)

    Hello @fanaticweb

    When a post is set to Draft status, URL for attachments are not longer available for users without capabilites to see Draft posts. So WordPress returns a 404 error for those users. Basically is the same that happens to the post URL, attachments tied to a post depends on the post availability.

    The same (but for different reasons) would happen to a deleted attachment, if you delete it the URL no longer exists in WordPress, therefore WordPress will return a 404 error like it does for any other deleted content.

    Attachment Pages Redirect will redirect only the URL for single existing attachments for which the user trying to access them has enough capabilities, because the plugin can run only once WordPress is ready to provide access to the page.

    It’s different if you delete the post. When a post is deleted without deleting the attached files, the attachments become “orphant”, they’re no longer tied to a post so they’re not ruled by the post status. So their URL would be valid and Attachment Pages Redirect would be able to redirect them to the WordPress home page.

    I hope the above is clear enough, let me know if you need any further clarification.

    Thread Starter Fanaticweb

    (@fanaticweb)

    Hi Samuel,

    Thank you so much for the detailed and elaborate feedback, and I’m glad you mentioned the last case scenario given I have a similar case ongoing as we speak, here’s a breakdown:

    P.S.: APR plugin was NOT activated yet
    1. Post expired and switched automatically to Draft status (domain.com/custom-taxonomy-category/post-name-slug)
    2. Admin deleted all attached images and reassigned Draft post to Admin (Post still exists offline to Admin only)

    At this point, when doing a search for any of the previous media files (domain.com/wp-content/uploads/2020/08/image-file.jpg), I’m getting the 404 Not Found, so far it’s normal behavior.

    Should I delete that post completely in order for APR to redirect the orphan images to the Homepage or is it too late now since the plugin was installed and activated AFTER the Post and images were removed?

    I have another active plugin that was custom made to Redirect expired/deleted posts to the Homepage but unfortunately it doesn’t redirect the attached images of those expired posts.

    Thank you and again looking forward for your feedback.

    • This reply was modified 9 months ago by Fanaticweb.
    Plugin Author Samuel Aguilera

    (@samuelaguilera)

    You’re welcome @fanaticweb

    2. Admin deleted all attached images and reassigned Draft post to Admin (Post still exists offline to Admin only)

    Should I delete that post completely in order for APR to redirect the orphan images to the Homepage or is it too late now since the plugin was installed and activated AFTER the Post and images were removed?

    As explained in my previous message, as you deleted the images there’s nothing to redirect. They don’t exists anymore and therefore their attachments pages are gone too. So WordPress will return 404 for them without a chance to do any other thing.

    So it’s not a matter of when the plugin was activated, that doesn’t affect to the plugin functionality, simply redirecting deleted images is not a feature of the plugin, the plugin needs an existing attachment page to do its job.

    Thread Starter Fanaticweb

    (@fanaticweb)

    Understood, it all comes down to the images existence, so once the image is deleted, the plugin cannot intervene, but wouldn’t that justify the role of the plugin after all? Or is there a rational reason why you didn’t code it that way?

    I’m thinking that in most cases, the images are deleted, be it by the Admin or other editing role users of the site, and that’s where the missing link kicks in.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.