Support

Account

Forum Replies Created

  • CPT Album
    — – Album
    | – Artist
    | – Length
    | – number of title
    | – genre …
    |
    | CPT Review
    | – Title (Review sentence)
    — – Album
    – Artist

    I’ve got a one to many relationship between CPT Album and CPT Review wit the field Album
    I want the field Artist to be automatically updated once an album is chosen in the CPT review

  • Hi John,

    it’s a field that is updated with the value of a field in an other CPT.
    therefore I use the post id store in an object relation field.

    CPT Album
    Title (album name)
    – Artist
    – Lenght
    – number of title
    – genre …

    CPT Review
    – Title (Review sentence)
    Album (object relation field pointing to CPT album)
    – Artist (updated from Albumn CPT through the object relationship field Album with Artist)

    function acf_review_album_band_update( $field ) {
    	$field = get_field('album_band',get_field('review_album'));
    return $field;
    }
    
    add_filter('acf/update_value/name=review_album_band', 'acf_review_album_band_update');

    it works, but it updates the artist name only when I publish, any chance to have something more dynamic ?

Viewing 2 posts - 1 through 2 (of 2 total)