Title: Red_Item::create throws error
Last modified: July 1, 2019

---

# Red_Item::create throws error

 *  Resolved [Joerg Gebauer](https://wordpress.org/support/users/newshoremedia/)
 * (@newshoremedia)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/)
 * Hi there,
 * we’re trying to automatically create redirects. Using `Red_Item::create()` just
   throws this error:
    `Uncaught Error: Class 'Red_Group' not found [...]` When 
   trying to debug everything seems to be there, including the class Red_Group.
 * This is the code we are trying to use with examplatory data:
 *     ```
       $redirectData    = array(
       		'url' => '/hello-world-123-xyz/',
       		'action_code' => 301,
       		'action_data' => '/2019/06/26/hello-world/',
       		'match_type' => 'url',
       		'group_id' => 1,
       	);
       	Red_Item::create( $redirectData );
       ```
   
 * Is this a bug in your plugin or are we using it wrong?
 * Thanks in advance!
    -  This topic was modified 6 years, 11 months ago by [Joerg Gebauer](https://wordpress.org/support/users/newshoremedia/).
    -  This topic was modified 6 years, 11 months ago by [Joerg Gebauer](https://wordpress.org/support/users/newshoremedia/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-11690018)
 * As the error message indicates you have not defined `Red_Group`. This is in the`
   group.php` file, which you will need to include.
 *  [filoveg](https://wordpress.org/support/users/filoveg/)
 * (@filoveg)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-11691963)
 * Thanks, I have solved it like this
 *  include_once WP_PLUGIN_DIR . ‘/redirection/models/group.php’;
 *  Thread Starter [Joerg Gebauer](https://wordpress.org/support/users/newshoremedia/)
 * (@newshoremedia)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-11691977)
 * Thanks, [@johnny5](https://wordpress.org/support/users/johnny5/)!
 * That did the trick.
 *  [Cabrahams](https://wordpress.org/support/users/cabrahams/)
 * (@cabrahams)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-11692265)
 * Sorry to leave this here, but hoping you can direct me. I had never signed up
   for the automated emails that I receive for this plug-in/topic. In fact the “
   subscribe” button is listed here in the column on the right. How can I unsubscribe?
   I don’t see that option. Thanks.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [6 years, 11 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-11692333)
 * [@cabrahams](https://wordpress.org/support/users/cabrahams/) You must have signed
   up some time in the past, intentionally or not. Go to the plugin’s support forum
   here: [https://wordpress.org/support/plugin/redirection/](https://wordpress.org/support/plugin/redirection/)
 * Then press the “Unsubscribe from this plugin” button.
 *  [Butterfingers](https://wordpress.org/support/users/cantbelieveitsnotbutter/)
 * (@cantbelieveitsnotbutter)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-12044386)
 * Hi John,
 * FYI, the above code (Joerg’s + filoveg’s) does get rid of the error, but for 
   me it doesn’t save anything. I’ve looked through the plugin code and stepped 
   through it with a debugger, and eventually I get hit with “invalid redirect” 
   + something or other (“action” I believe; I did this twenty-or-so minutes ago,
   and it’s Friday). After trying all kinds of things with the data array, I gave
   up and am just using wpdb to do direct SQL queries for a data migration. It’s
   sad, but works. Anyway, maybe you can take a look in your spare time. Sure would
   love some documentation for PHP besides: use REST, two sentences, and exhortations
   on the forums to study your code. Cheers.
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-12044701)
 * You can find a little more info here: [https://redirection.me/developer/](https://redirection.me/developer/)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Red_Item::create throws error’ 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/)

 * 7 replies
 * 6 participants
 * Last reply from: [John Godley](https://wordpress.org/support/users/johnny5/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/red_itemcreate-throws-error/#post-12044701)
 * Status: resolved