• Resolved olivvv59

    (@olivvv59)


    Hi,

    Is it possible to automatic redirect to the listing page after editing ?

    I don’t find in the documentation.

    thanks
    Olivier

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support alexrollin

    (@alexrollin)

    Try following PHP snippet to redirect to specific page after submit listing.

    Use the Code Snippets plugin to add the snippet

    /**
     * Redirect to specific url after add listing form submitted.
     */
    function gd_snippet_ajax_save_post_message( $message, $post_data ) {
    	if ( isset( $post_data['post_status'] ) && $post_data['post_status'] == 'publish' ) {
    		$redirect_to = get_permalink( $post_data['ID'] ); // CHANGE URL HERE
    		ob_start();
    		?>
    		<script type="text/javascript">window.location = '<?php echo $redirect_to; ?>';</script>
    		<?php 
    		$redirect_to_js = ob_get_clean();
    
    		$message .= trim( $redirect_to_js );
    	}
    
    	return $message;
    }
    add_filter( 'geodir_ajax_save_post_message', 'gd_snippet_ajax_save_post_message', 100, 2 );

    You can set desired url in line $redirect_to = get_permalink( $post_data[‘ID’] ); Example: $redirect_to = ‘https://amuwoyellowpages.com&#8217;;

    Thread Starter olivvv59

    (@olivvv59)

    thank you very much !!

    this is exactly what i was looking for.

    i add it to my functions.php file. it works like a charm

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatic Redirect after submitting a listing’ is closed to new replies.