dongru2019 2009-01-30 13:23
浏览 45
已采纳

如何在Wordpress中重定向到不同的管理页面?

I am writing a Wordpress plugin.

I want to perform a redirect (after creating DB records from POST data, etc...) to other ADMIN page.

Neither header("Location: ...) nor wp_redirect() work - i get

Warning: Cannot modify header information - headers already sent by

which comes from obvious reason.

How do I properly perform a redirect in a Wordpress?

  • 写回答

7条回答 默认 最新

  • donglanfu5831 2011-01-26 20:10
    关注

    On your form action, add 'noheader=true' to the action URL. This will prevent the headers for the admin area from being outputted before your redirect. For example:

    <form name="post" action="<?php echo admin_url('admin.php?page=your-admin-page&noheader=true'); ?>" method="post" id="post">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?