My problem is one that i can’t seem to find a solution to.
I have 2 Custom Post Types, Mangas and Chapters, every chapter published will always be connected to a manga via the ACF relationship field.
The current permalink structure for the chapter is site.com/chapters/chapter-title and what i want is site.com/mangas/connected-manga/chapter-title
Since wordpress doesn’t offer much in the way of post-to-post relationships, the ACF relationship field is great for this and i have everything figured out except for this… the permalink.
Any help would be appreciated. Please bear in mind that i don’t want to use an extra plugin for this.
				
		
	 
	
	
		
	
		
	
		
		
	
	
		
		
			
		
	
	
		
		
		Hi, 
In cases like you, unfortunately the nature of wp’s url, you gonna have to add the rewrite rule yourself.
You can have a look at add_rewrite_rule.
https://codex.wordpress.org/Rewrite_API/add_rewrite_rule
So, your code will look something like: 
function custom_rewrite_basic() {
    add_rewrite_rule('^mangas/([^/]*)/([^/]*)/?', 'index.php?chapters=$matches[2]', 'top');
}
add_action('init', 'custom_rewrite_basic');
Cheers
				
		
	 
	
	
		
	
		
	
		
		
	
	
		
		
			
		
	
	
		
		
		Oh, forgot one more thing.
remember to go to the backend, Settings->Permalink and click save. so your custom rewrite rule will be saved.
Cheers
				
		
	 
	
	
		
	
		
	
		
		
	
	
		
		
			
		
	
	
		
		
		Hello,
you can do it without adding any permalink structure via hooks using the plugin:
https://github.com/athlan/wordpress-custom-fields-permalink-plugin/
and use any custom post field generated by ACF in URL permalink.
Cheers,
Athlan