I am working on a project which has a functionality of "featured_posts" based on this discussion. I have created a table which lists all the posts. I have a checkbox in each row which upon click submits the for through javascript. when the box is checked, it updates everything and marks the post as featured. As a test, i disabled all the featured posts. Upon unchecking the last checkbox, i got
Warning: Invalid argument supplied
warning. My code is
foreach( $_POST['list_id'] as $listID ) {
if( update_post_meta( $listID, '_property_featured', 'true' ) ) {
$featureMessage = "Selected listings have been marked as featured successfully.";
}
else $featureError = "An error occurred. Please try again.";
}
list_id refers to the post_id and was in the value attribute of checkbox. I know when the last checkbox was unchecked, i had to face this warning. Question is how can I track unchecking of checkbox as it is not included in the POST data of the form.