In my WP plugin I have a simple form and corresponding function:


 * Partial of the události
 * @package    vysledky
 * @subpackage vysledky/admin/partials

    add_action( 'admin_post_udalosti', 'proved_udalosti_test' );
    function proved_udalosti_test () {
        echo "I am in my function";


<div id="udalosti" class="wrap">
<h3>Zadej zobrazení událostí</h3>
<form action="<?php echo admin_url('admin-post.php'), '?action=udalosti'; ?>" method="post">
<table style="line-height:70%;">
<tr><th><input type="submit" name="proved" value="Zobraz události" /></th></tr>

The echo string does not display, blank page instead. Where do I make mistake?

1 Answer 1


You need to add another action to allow anonymous (not logged in) users to submit the form.

add_action( 'admin_post_udalosti', 'proved_udalosti_test' );
// Allows anyone to submit this form.
add_action( 'admin_post_nopriv_udalosti', 'proved_udalosti_test' );
  • All this is running with superadmin logged-in during website administration.
    – j-prause
    May 23, 2019 at 18:55
  • Understood. If that's the case, you'll want to move the action from the template to somewhere else. May 23, 2019 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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