I'm trying to re-write permalink structure with my own custom url in WordPress for a Divi Theme "project"
I have already changed the "Divi slug" from "project" to "prodotti" so currently, the URL appears like this:
http://www.example.com/prodotti/%postname%/
with my custom function
function custom_post_name() {
return array(
'feeds' => true,
'slug' => 'prodotti',
'with_front' => false,
);
}
add_filter('et_project_posttype_rewrite_args', 'custom_post_name');
I want to add to these urls a variable, that reside for each post in post_metadata, in order to build a url like:
http://www.example.com/prodotti/<mypostoptionvalue>/%postname%/
ex:
http://www.example.com/prodotti/AEX1102/%postname%/
http://www.example.com/prodotti/AEX1103/%postname%/
http://www.example.com/prodotti/AEX1104/%postname%/
Is there a way to achieve this kind of behavior?
I have done many test using, {$permastruct}_rewrite_rules
, page_rewrite_rules
, post_rewrite_rules
and more starting from: https://codex.wordpress.org/Class_Reference/WP_Rewrite without results.