Helllo I am trying to update a field in a portfolio post but I am not sure if I am referencing the portfolios properly
// Update the "portfolio_sort" field of related portfolio posts
$portfolio_args = array(
'post_type' => 'portfolio_item', // Adjust the post type as needed
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'client',
'field' => 'term_id',
'terms' => $term->term_id,
),
),
);
$portfolio_posts = get_posts( $portfolio_args );
foreach ( $portfolio_posts as $portfolio_post ) {
// Update the ACF date field "portfolio_sort" with the latest published date
update_field( 'portfolio_sort', $latest_published_date, $portfolio_post->ID );
}
}
are portfolios post type portfolio or portfolio item ?