Site icon Hip-Hop Website Design and Development

How to add a post slug to a url?

For a task i’m dealing with I attempt to add the slug of a custom post sort to the furthest limit of a url.

The case:

When a client rounds out a contact structure, the email that gets send necessities to have a connection to the clients profile post. The name of the post sort is actor. The slug (or whatever should be added to the url) should be dynamic. So for instance when John Do is signed in and rounds out the structure, the connection should resemble this: example.com/entertainer/john-do.

This are the codes I attempted out.

 work acf_load_field( $field ) { 

/$current_user = wp_get_current_user(); 

/$profile_link = "example.com/en/entertainer/$current_user->ID"; 

/$slug = get_post_field( 'post_name', get_post() ); 

/$profile_link = "example.com/en/entertainer/$slug"; 

$post_type = get_post_type(); 

$post_type_data = get_post_type_object( $post_type ); 

$post_type_slug = $post_type_data->rewrite['slug']; 

$profile_link = "example.com/en/entertainer/$post_type_slug"; 

$field['default_value'] = $profile_link; 

return $field; 

} 

add_filter('acf/load_field/name=profile_link_actor_profile', 'acf_load_field'); 

The last code yields the url with the custom post kind of the page it is displayed on. Which is called project.

I can’t sort out what I need to do to add the slug the actor present sort on the url.

Any help would be enormously appreciated.