Okay so I’ve got a table on the front end which displays all my custom posts with their custom fields.
I’ve got a custom field ‘liststatus’ which either shows ‘Unread’ or ‘Read’
Essentially I want to add a button to the end column to mark the custom field value as ‘Read’
The table is filtered so it doesn’t show posts with the value of ‘Read’
Firstly is this possible? Secondly can anyone point me in the direction of documentation or a snippet to do this with php?
<form method="post">
<button name="markAsRead">test</button>
</form>
<?php
if(isset($_POST['markAsRead'])){
update_post_meta( $post_id('get_the_ID()'), $meta_key('liststatus'), $meta_value('Unread') );
}
?>
That’s what i’ve got so far