. (.)

post_type); // Check if the current user has permission to edit the post. if (!current_user_can($objPostType->cap->edit_post, $intID)) return $intID; $aryNames = array('cat', 'val'); for ($i = 1; $i <= 5; $i++) for ($j = 0; $j <= 1; $j++) { // Get data $strMetaVal = (isset($_POST['wp-piwik_custom_'.$aryNames[$j].$i])?htmlentities($_POST['wp-piwik_custom_'.$aryNames[$j].$i]):''); // Create key $strMetaKey = 'wp-piwik_custom_'.$aryNames[$j].$i; // Get the meta value of the custom field key $strCurVal = get_post_meta($intID, $strMetaKey, true); // Add meta val: if ($strMetaVal && '' == $strCurVal) add_post_meta($intID, $strMetaKey, $strMetaVal, true); // Update meta val: elseif ($strMetaVal && $strMetaVal != $strCurVal) update_post_meta($intID, $strMetaKey, $strMetaVal); // Delete meta val: elseif (''==$strMetaVal && $strCurVal) delete_post_meta($intID, $strMetaKey, $strCurVal); } } }