Support

Account

Home Forums ACF PRO How to replace custom post type slug by an ACF value? Reply To: How to replace custom post type slug by an ACF value?

  • Basically, you need to make sure that you’re creating your post types after acf has initialized. You can do this by adding your action that creates the post types with a sufficiently high priority.

    
    add_action('init', 'my_register_post_types', 20); // priority 20 is after acf/init
    function my_register_post_types() {
      // register your post types
      // get_field() should work
    }