custom fields - Wordpress update_post_meta does not update dynamic values -
custom fields - Wordpress update_post_meta does not update dynamic values -
this little strange, using "update_post_meta" update custom fields in wordpress. when run update_post_meta($post_id, 'test_field', 'test value'); custom field updates without problem when utilize string value not update:
$test_value = "test"; echo $test_value; // no problem here echo $post_id; // no problem here update_post_meta($post_id, 'test_field', $test_value);
thanks much in advance help
stu
try cast variables types. seek this:
update_post_meta( (int) $post_id, 'test_field', (string) $test_value );
wordpress custom-fields
Comments
Post a Comment