• Resolved mehdi.gpr

    (@mehdigpr)


    Hi,
    I want to Create a redirect with Redirection Plugin in custom code (without visually),
    Is there a Create_Redirect function in the redirection plugin?

    How can I Create a Redirect with functions of this plugin ?

    thanks.

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

    (@johnny5)

    Thread Starter mehdi.gpr

    (@mehdigpr)

    thank you.
    I had seen this. But I had trouble using it. Information was not enough for a beginner ??
    I want to use php api and Red_Item::create().

    Is it possible to show how to work with this class with an example ? What items will be included in Red_Item_Sanitize?

    Thank you very much.

    Plugin Author John Godley

    (@johnny5)

    I don’t currently have any examples. You will need to look at the code in redirect-sanitizer.php and see what data is used

    Thread Starter mehdi.gpr

    (@mehdigpr)

    I Tested this :

    
    $red_arr = array(
    	'title' => 'test',
    	'group_id' => 1,
            'source' => 'https://domain.com/google',
    	'url' => 'https://google.com'
        );
    include plugin_dir_path( __DIR__ ).'Redirection/models/redirect.php';
    $redirect = new Red_Item();
    $reds = $redirect->create($red_arr);
    

    But Not working!!!
    I’m probably having a problem in the Array structure.
    Alert message : The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

    anyone help…

    Plugin Author John Godley

    (@johnny5)

    As I said there is no example and you will need to figure things out from the code. You should call Red_Item::create instead of creating an object.

    print_r( $reds ); will show you what the problem is.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Create Redirection in Custom Code’ is closed to new replies.