Suppose i have a function

function mytable(){
$count_value = get_kudos_count( $post_id ); }

How to send $count_value dynamically to the custom field present in WordPress post ?

Let us assume the custom field name (key) is custom_count


You can use update_post_meta:

update_post_meta( $post_id, 'custom_count', $count_value );
| improve this answer | |
  • can you briefly explain it. where i should place the function, and send the output values to the field custom_count. – sandeep arron Sep 14 '15 at 5:28
  • I have no idea what the purpose of your function is, so I don't know where you need to put it. – Milo Sep 14 '15 at 5:47
  • It worked, since i am using ACF plugin i used update_field() function. – sandeep arron Sep 14 '15 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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