I have a page on WordPress, that has a button and when the user clicks this button it will save the page, and the link change to the page link.
What I want is to make the user redirect to another page URL after clicking this button and the page gets saved.
these are the buttons, but I want to make the redirect work on both or only the Submit for Review button.
<?php do_action( 'tutor/dashboard_course_builder_form_field_after', $post ); ?>
<div class="tutor-form-row tutor-form-submit">
<div class="tutor-form-col-12">
<div class="tutor-form-group">
<div class="tutor-form-field tutor-course-builder-btn-group">
<button type="submit" class="tutor-button btn-save-as-draft"
name="course_submit_btn"
value="save_course_as_draft"><?php esc_html_e( 'Save course as draft', 'edumall' ); ?></button>
<?php if ( $can_publish_course ) : ?>
<button class="tutor-button tutor-success" type="submit"
name="course_submit_btn"
value="publish_course"><?php esc_html_e( 'Publish Course', 'edumall' ) ; ?></button>
<?php else : ?>
<button class="tutor-button tutor-success" type="submit"
name="course_submit_btn"
value="submit_for_review"><?php esc_html_e( 'Submit for Review', 'edumall' ); ?></button>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
In PHP redirections are handled by the header() function, in the form:
header("Location: http://www.example.com/");
But make sure you are editiog the PHP file that proccess the form data (the action attibute probabily is pointing to the file). Note that the "header()" function will redirects the page before any output and no content outputed from the page will display. You can check other strategies at the function documentation page.