To premise this, I have already read another stack overflow post on this topic, but the point did not seem to get across correctly nor did it seem to be answered.
Here is our issue — when a new post is created on our wordpress site, by default, no custom fields appear, unless added by the publisher of the post. As soon as the post is published/updated, two custom fields populate the post and can no longer be removed unless manually removed one by one in phpmyadmin.
The two fields being auto added are header_image
and header_image_id
.
Upon manually deleting them from the post in phpmyadmin, they do successfully delete from our site as well as from the post.
Here is where the problem becomes more annoying. After removal of those two custom fields in phpmyadmin, upon updating the post in wordpress with the removed custom fields, they reappear again.
Something is going on and we do not know what.I have been on with wpengine support for an hour now and they cannot help me yet.
If anyone has any knowledge of this, please help. We need to resolve this soon.
Also if you need more details/explanation, let me know and I will be happy to provide.
2
Answers
So after much digging, we found these two lines of code in our post.php file:
update_post_meta( $post_id, 'header_image', esc_url_raw( $_POST['header_image'] ) );
update_post_meta( $post_id, 'header_image_id', intval( $_POST['header_image_id'] ) );
I commented them out, and this fixed our issue!
Have you tried to take a look at functions.php and content.php where those fields are retrieving/showing information?