Function to modify slug create a bug in elementor pro templates
-
Hello guys,
i’m using a custom function to add .html to my pages & cpt.
everything works well, except Elementor Pro templates.I have find what is creating the bug, but have no idea what i did wrong.
function custom_post_permalink( $post_link, $post ) { // Accept $post argument. $post_type = get_post_type( $post->ID ); // $post now refers to the one passed as an argument. $post_type_data = get_post_type_object( $post_type ); $post_type_slug = $post_type_data->rewrite['slug']; $post_type_slug_translated = apply_filters( 'wpml_get_translated_slug', $post_type_slug, $post_type ); $translated_home_url = apply_filters( 'wpml_home_url', home_url() ); $be_default_lang_settings = get_option( 'icl_sitepress_settings' ); $be_default_lang = $be_default_lang_settings['default_language']; $be_current_lang = apply_filters( 'wpml_current_language', NULL ); if ( $be_current_lang === $be_default_lang ) { 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', 10, 2 );
If you have any idea.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Function to modify slug create a bug in elementor pro templates’ is closed to new replies.