• Resolved Joerg Gebauer

    (@newshoremedia)


    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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author John Godley

    (@johnny5)

    As the error message indicates you have not defined Red_Group. This is in the group.php file, which you will need to include.

    Thanks, I have solved it like this

    include_once WP_PLUGIN_DIR . ‘/redirection/models/group.php’;

    Thread Starter Joerg Gebauer

    (@newshoremedia)

    Thanks, @johnny5!

    That did the trick.

    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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @cabrahams You must have signed up some time in the past, intentionally or not. Go to the plugin’s support forum here: https://www.ads-software.com/support/plugin/redirection/

    Then press the “Unsubscribe from this plugin” button.

    Butterfingers

    (@cantbelieveitsnotbutter)

    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

    (@johnny5)

    You can find a little more info here: 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.