Support » Plugin: 301 Redirects - Easy Redirect Manager » Is there a way to add a 301 redirect programmatically?

  • Resolved robbiegod

    (@robbiegod)


    Just a quick question. I am working on a plugin to delete a few hundred posts from my site. As part of that, i want to automate the deletion and then have a 301 redirect automatically created. All deleted posts should redirect to the same page.

    For example, pretend I have an automobile website. I have a custom post type called automobiles. Then I have 500 posts each with a different post about a car.

    My plugin would delete these cars from a list i provide (it would be a list of post ids) and then delete them from wordpress. It should also create a 301 redirect to go from the post page to the main /automobiles page on my site.

    Is that possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WebFactory

    (@webfactory)

    Hi,
    We don’t have an API or any public-facing functions at the moment. Sorry πŸ™

    However, create a few redirects by hand. Then open up the table where redirects are stored – (site_tbl_prefix_)redirects. See how those redirects are saved and just insert more rows directly in the table for the new rules you need. It should work without any problems.

    Thread Starter robbiegod

    (@robbiegod)

    yep, that will work! Thank you! That is actually perfect.

    Plugin Author WebFactory

    (@webfactory)

    You’re welcome πŸ™‚

    If you have a minute, please leave a review. It’s what keeps support going. Thank you πŸ™ https://wordpress.org/support/plugin/eps-301-redirects/reviews/#new-post

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