How to update custom field in Post table after add post?
-
I have hook, that works after adding post:
add_action( ‘save_post’, ‘save_func’, 10, 3 );
And function
save_func
:function save_func($ID, $post,$update) { if($update == false && isset( $_POST['redirect_url'])) { update_post_meta( (int) $ID, 'link', (string) "test" ); } }
So, in table
Post
I have created custom VARCHAR fieldlink
.I tried to update this field like as:
update_post_meta( (int) $ID, 'link', (string) "test" );
But it does not work, the field is empty still.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to update custom field in Post table after add post?’ is closed to new replies.