actions - admin_post hook not working

I have this inside the <form><form>:<input type="hidden" name="action" value="s

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( '/', 301 );
        exit();
}
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?

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/', 301 );
        exit();
}
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?

Share Improve this question edited Jun 6, 2019 at 20:56 nmr 4,5672 gold badges17 silver badges25 bronze badges asked Jun 6, 2019 at 20:50 D.G.D.G. 1 2
  • you have an underscore after "maybe_add" in your add_action – rudtek Commented Jun 6, 2019 at 23:26
  • does this action hook actually exist? where did you get your code from? what are you trying to achieve? – Michael Commented Jun 7, 2019 at 21:29
Add a comment  | 

1 Answer 1

Reset to default 1

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/', 301 );
    exit();
}
add_action( 'admin_post_submit_images', 'my_maybe_add_redirect', 10, 2 );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745429744a4627338.html

相关推荐

  • actions - admin_post hook not working

    I have this inside the <form><form>:<input type="hidden" name="action" value="s

    6小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信