Home › Forums › Front-end Issues › relationship – impossible to get permalink › Reply To: relationship – impossible to get permalink
Hello,
after many investigation, i found what is making this trouble !
its a custom code i used to add a .html extension to all my pages & customs posts.
but i can not figure what in this code is creating this trouble :s
my function
function custom_post_permalink ($post_link) {
global $post;
if($post) {
$type = get_post_type($post->ID);
$post_type_data = get_post_type_object( $type );
$post_type_slug = $post_type_data->rewrite['slug'];
$post_type_slug_translated = apply_filters( 'wpml_get_translated_slug', $post_type_slug, $type);
$translated_home_url = apply_filters( 'wpml_home_url', home_url());
$be_current_lang = apply_filters( 'wpml_current_language', NULL );
if($be_current_lang=='fr'){
return $translated_home_url . $post_type_slug_translated . '/' . $post->post_name . '.html';
} else {
return $translated_home_url .'/'. $post_type_slug_translated . '/' . $post->post_name . '.html';
}
}
}
add_filter('post_type_link', 'custom_post_permalink');
Thanks in advance for your help
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.