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
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.