Title: Function to create a redirection programmatically
Last modified: April 18, 2019

---

# Function to create a redirection programmatically

 *  Resolved [Jordi Cabot](https://wordpress.org/support/users/softmodeling/)
 * (@softmodeling)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/function-to-create-a-redirection-programmatically/)
 * Hi,
 * I’m developing a plugin that merges quasi-duplicated tags. As part of the merge,
   I’d like to automatically create a redirect the URL of the deleted tag page to
   the tag page of the “surviving” tag.
 * Is there an easy way to call your plugin code from mine to create a new redirection
   rule?
 * Thanks!

Viewing 1 replies (of 1 total)

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/function-to-create-a-redirection-programmatically/#post-11443464)
 * All functions are exposed in the WordPress REST API, which you can call internally:
 * [https://developer.wordpress.org/rest-api/requests/#internal-requests](https://developer.wordpress.org/rest-api/requests/#internal-requests)
 * Alternatively you can use `Red_Item::create()`, found in `models/redirect.php`

Viewing 1 replies (of 1 total)

The topic ‘Function to create a redirection programmatically’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [tag](https://wordpress.org/support/topic-tag/tag/)

 * 1 reply
 * 2 participants
 * Last reply from: [John Godley](https://wordpress.org/support/users/johnny5/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/function-to-create-a-redirection-programmatically/#post-11443464)
 * Status: resolved