Another easy solution to avoid having these meta info, is just to check is there is actually any code on the AddFunc Head & Footer Code metabox, before saving.
So instead of using
if( isset( $_POST[‘aFhfc_head_code’] ) )
update_post_meta( $post_id, ‘aFhfc_head_code’, $_POST[‘aFhfc_head_code’] );
if( isset( $_POST[‘aFhfc_footer_code’] ) )
update_post_meta( $post_id, ‘aFhfc_footer_code’, $_POST[‘aFhfc_footer_code’] );
use this instead
if( !empty( $_POST[‘aFhfc_head_code’] ) )
update_post_meta( $post_id, ‘aFhfc_head_code’, $_POST[‘aFhfc_head_code’] );
if( !empty( $_POST[‘aFhfc_footer_code’] ) )
update_post_meta( $post_id, ‘aFhfc_footer_code’, $_POST[‘aFhfc_footer_code’] );
So if the User never user AddFunc Head & Footer Code for a page or a post, you won’t save this meta info for that post, avoiding in this way creating garbage data in the postmeta table that it won’t ever be used.
-
This reply was modified 7 years, 11 months ago by xlan.
-
This reply was modified 7 years, 11 months ago by xlan.