[wp-hackers] get_user_meta cached

Joaquin Rodriguez Montero yojoaquin at gmail.com
Wed Mar 27 18:11:38 UTC 2013


He guys, quick one: I'm updating / adding a user meta field via a form
through POST. It adds / update the data. But when the page refreshes I get
an old value. How can I avoid that? I guess is because the value was
cached.. but when I refresh the page again I get the new value.. could
anyone help me please? I'd like to see the new value immediately after the
form is sent and the page has refreshed because of this.

On my functions I've got:

function chocks_adds_mark($userid, $workid) {

     $meta_key = "work_id_".$workid;

     if(!empty($_POST['myMark'])) {

     $mark = $_POST['myMark'];

     update_user_meta("$userid","$meta_key", "$mark");

     }

}

And my form on single-attachment is:

<form name="marksform" method="post" action="<?php calificar($userid,
$workid); ?>" >

   <label>Calificación: </label>

   <input type="text" name="myMark" value="<?php if(!empty($calificacion_nota))
: echo $calificacion_nota; endif; ?>" /><br />

   <?php wp_nonce_field('marksform'); ?>

   <input type="submit" name="enviar" value="Calificar"/>

   </form>

Thanks!


More information about the wp-hackers mailing list