Create a redirection programmatically

#82787
  • Resolved Prosite
    Rank Math free

    Hi,

    I’m trying to understand ho to create a redirect programmatically.
    I tried adding a redirect directly the database in wp_rank_math_redirections but I think I don’t understand the sources json object correctly.
    This is what I added: a:1:{i:0;a:3:{s:6:”ignore”;s:0:””;s:7:”pattern”;s:4:”rood”;s:10:”comparison”;s:5:”exact”;}} but when I look in the admin interface only the url_to show up.
    I’m working with a content type that get’s imported and that needs to receive 2 url’s. One real url for the visitor and for SEO but also a shorter one for administration purposes. This shorter one need to be redirected to the long one.

    Can yu give me an example on how to do that in a plugin? I already looked at https://rankmath.com/kb/filters-hooks-api-developer/ but I’m not sure how to add a redirect.

    B.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for getting in touch with us.

    If there is a pattern, you can use the regex method.

    Unfortunately, we do not have any filters that let you add the redirections programmatically.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Create a redirection programmatically’ is closed to new replies.