Support

Account

Home Forums Front-end Issues Multiple Authors with ACF field

Solving

Multiple Authors with ACF field

  • Hi,
    I’ve got a custom post type (Informe Mensual) with frontend posting via an ACF Pro Form.
    I need to be able to select multiple authors using the form fields. I’ve been able to select ONE author using a User Field with this code:

    function my_acf_save_post( $post_id ) {
        // get new value
        $user = get_field( 'author', $post_id );
    	if( $user ) {
    		wp_update_post( array( 'ID'=>$post_id, 'post_author'=>$user['ID']) ); 
    	}
    }
    add_action('acf/save_post', 'my_acf_save_post', 20);

    ¿How should I modify the code so I can select multiple authors? I’ve tried enabling “select multiple values” on the field options, but it doesn’t work.

    Thanks in advance!

  • In WP each post can only have a single “Author”, there isn’t any way to change this except to stop using the WP built in “Author” field and only use an ACF user field and change all code as needed to use this field instead of the standard author value.

  • OK, thank you John.
    That’s too advanced for me.
    I’ll figure out another solution.

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

The topic ‘Multiple Authors with ACF field’ is closed to new replies.