WordPress.org

Support

Support » How-To and Troubleshooting » save_post action has empty $_POST?

save_post action has empty $_POST?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dont check for isset of $_post here as you want to update your meta value.
    check for empty $_POST for the meta key and the update as you want .

    if ($_POST['event_date_begin']!='')
    	update_post_meta($ID, 'event_date_begin',date('Y/m/d', strtotime($_POST['event_date_begin'])));
    else
    	update_post_meta($ID, 'event_date_begin', 'empty');

    and please check that meta key you used is correct.

    I was struggling with a similar strange problem with a site that otherwise worked. It all worked on a different host, too – the development host. But deployed to production, every form had an empty $_POST and was not treated like a POST, even though I could see a POST in the webserver logfiles.

    I eventually found the cause, accidentally, when solving what seemed like a lower priority problem. The error logfile for the Apache server was complaining about “Negotiation: discovered file(s) matching request: … (None could be negotiated)”.

    When I fixed that (removed the Option for MultiViews in the Apache Virtual Server configuration file), I got $_POST filled in.

    So it may be a subtle server configuration problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘save_post action has empty $_POST?’ is closed to new replies.
Skip to toolbar