Support

Account

Home Forums Backend Issues (wp-admin) Using ACF to create CPT in back-end Reply To: Using ACF to create CPT in back-end

  • Hi Damian P. Try using get_sub_field(‘cpt-name’) instead of the_sub_field(‘cpt-name’)

    
    <?php 
    if( have_rows('additional-post-type', 'option') ):
       while ( have_rows('additional-post-type', 'option') ) : the_row();
    
       function custom_post_type() {
            $labels = array(
                'name' => _x( get_sub_field('cpt-name'), 'Post Type General Name', 'twentythirteen' ),
                // others
            );
            $args = array(
                // options
            );
            register_post_type( 'movies', $args );
        }
        add_action( 'init', 'custom_post_type', 0 );
    
    endwhile;
    endif;