I want to use custom post types instead of database tables.
I've created the CPT and can post data to it from the WordPress admin - however, I would like users to be able to post to it too, and also edit and update their own entries (this will be a fitness tracker type site).
I can read data back from the CPT and display it, but when looking for any info on updating data in the CPT, all I find are references on how to update the CPT itself, not data within it.
This is my code for reading from the CPTs:
if ($query->have_posts()) {
while ($query->have_posts()) {
global $post;
$query->the_post();
$id = get_the_ID();
echo $id;
$post_meta = get_post_meta($id);
$measure = $post_meta['measure_description'][0];
$record = $post_meta['unit_type'][0];
$latestres = $post_meta['latest_result'][0];
$datet = $post_meta['result_date'][0];
$postauthor = get_the_author();
//show data onscreen here
}
}
Can anyone point me to a reference on how to post data to a CPT and how to update data in an existing CPT record?
Thank you,
Mark