Add custom ID to CPT posts only create not update

Yes, it’s simple – check for existence of id_valoraciones meta value when saving post. If post does not have id_valoraciones set, do your job with getting last value and incerementing it. If the post has id_valoraciones meta, then – do nothing. Like this: <?php function auto_assign_ids( $post_id, $post, $update ) { // Only assign ID … Read more

CPT EVENT – listing by month and filtering by category and month – form select option

Problem solved! Before – Select Month <option value=”01″></option> <option value=”02″></option> etc. Change – Select Month <option value=”20210101″></option> <option value=”20210201″></option> etc. //ARGS $selected_cat = $_GET[‘cat’]; //category value $start_date = $_GET[‘month’]; //month value $end_date = $start_date + 30; ‘meta_query’ => [ [ ‘key’ => ‘event_date’, //acf date picker field Ymd ‘value’ => array($start_date, $end_date), ‘compare’ => ‘BETWEEN’, … Read more