I have this inside the <form></form>:

<input type="hidden" name="action" value="submit_images" data-parsley-excluded />

I have this as my hook just to test:

function maybe_add($entry, $form) {
        wp_redirect( 'https://www.google.com/', 301 );
add_action( 'admin_post_submit_images', maybe_add_', 10, 2 );

I never get redirected to google though no matter what I've tried. Any ideas?

  • you have an underscore after "maybe_add" in your add_action – rudtek Jun 6 '19 at 23:26
  • does this action hook actually exist? where did you get your code from? what are you trying to achieve? – Michael Jun 7 '19 at 21:29

You're missing a ' in your code and your function name is different.

function my_maybe_add_redirect( $entry, $form ) {
    wp_redirect( 'https://www.google.com/', 301 );
add_action( 'admin_post_submit_images', 'my_maybe_add_redirect', 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.