How do i hide the auto-generated custom field that’s created when update_post_meta() is called?

I’ve added a custom textarea for the create/edit post admin page. I did so using the add_meta_box() function. The problem is that the add_meta_box() callback function (which saves the data input into the textarea) calls the update_post_meta(). update_post_meta() then adds a custom field within the custom field section. So you essential end up with two textareas for the same field! The one you’ve created and the auto generated one!

Is there a way to remove the auto generated custom field?

Thanks,
Jon

1 Answer
1

If the meta field starts with an underscore, it will be hidden in the interface by adding the class hidden to the <tr> element. You could also apply this class by yourself using Javascript, the <tr> element has an id of meta-{$custom_field_id}.

Leave a Comment