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

  • You’re welcome!

    I tried with your code and didn’t work for me too, so I did a few changes and now works for me.
    In this code I use a function called slugify (, to create the CPT slug.

    Tell me if it works for you

    if( have_rows('additional-post-type', 'option') ) {
        function register_post_types() {
           while ( have_rows('additional-post-type', 'option') ) { the_row();
                $cpt_name = get_sub_field('cpt-name');
                $cpt_slug = slugify($cpt_name);
                // new custom post type
                    $cpt_slug , array(
                        'public' => true,
                        'labels' => array(
                            'name' => __($cpt_name, 'theme'),
                            'singular_name' => __($cpt_name, 'theme'),
                        'has_archive' => true,
                        'supports' => array(
        add_action( 'init', 'register_post_types' );