Pasar variable para actualizar custom field wordpress
AUTOR PREGUNTA #1
-
¿Tienes la misma pregunta? Yo también
Esto también te interesa!
PREGUNTAS SIMILARES
#2
function actualizar($id, $post)
{
if($post->post_type != 'tipopost') {
return;
}
update_post_meta($id, 'totalpagos', sanitize_text_field( $_POST['pago'] ) );
}
add_action('save_post', 'actualizar');Lo que hace es que cuando se edite y acutalice un post se dispare esta funcion, si el tipo de post coincide, entonces se actualiza el custom field con el valor enviado en el formulario