Replace permalink with 'your_acf_field_name' your ACF
function my_custom_permalink_filter( $post_link, $post ) { if ( 'news-articals' === $post->post_type ) { // Target your specific post type name here $acf_field_value = get_field( 'url', $post->ID ); // Replace 'your_acf_field_name' with your ACF field name if ( $acf_field_value ) { $post_link = $acf_field_value; // Replace the tag with the sanitized ACF value } } return $post_link; } add_filter( 'post_type_link', 'my_custom_permalink_filter', 10, 2 );