Look at this code:
update_post_meta( $post_id, 'owl_mb_content', strip_tags( $_POST['owl_mb_content_one'] ) );
update_post_meta( $post_id, 'owl_mb_title', strip_tags( $_POST['owl_mb_title_one'] ) );
update_post_meta( $post_id, 'owl_mb_content', strip_tags( $_POST['owl_mb_content_two'] ) );
update_post_meta( $post_id, 'owl_mb_title', strip_tags( $_POST['owl_mb_title_two'] ) );
update_post_meta( $post_id, 'owl_mb_content', strip_tags( $_POST['owl_mb_content_three'] ) );
update_post_meta( $post_id, 'owl_mb_title', strip_tags( $_POST['owl_mb_title_three'] ) );
The second value is the key. Each update overwrites the previous. If you check the database, you should see the *three
values. Comment out the *three
lines and you will see the *two
values.
I don’t know exactly what you are trying to achieve, but as written update_post_meta
is overwriting your values.
Perhaps you want owl_mb_content
and owl_mb_title
in a serialized array, or as multiple keys but I don’t know how you’d distinguish the different content that way. So, I am assuming you want three different keys.
update_post_meta( $post_id, 'owl_mb_content_one', strip_tags( $_POST['owl_mb_content_one'] ) );
update_post_meta( $post_id, 'owl_mb_title_one', strip_tags( $_POST['owl_mb_title_one'] ) );
update_post_meta( $post_id, 'owl_mb_content_two', strip_tags( $_POST['owl_mb_content_two'] ) );
update_post_meta( $post_id, 'owl_mb_title_two', strip_tags( $_POST['owl_mb_title_two'] ) );
update_post_meta( $post_id, 'owl_mb_content_three', strip_tags( $_POST['owl_mb_content_three'] ) );
update_post_meta( $post_id, 'owl_mb_title_three', strip_tags( $_POST['owl_mb_title_three'] ) );
And that matches how you are trying to retrieve the values.