Advertisement
mbis

WPML ATE - inherit custom permalink

Jun 1st, 2020
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. function pm_ate_inherit_permalink($post_id, $fields) {
  2.     global $permalink_manager_uris, $sitepress;
  3.  
  4.     if(class_exists('Permalink_Manager_URI_Functions_Post')) {
  5.         $original_post_id = $sitepress->get_original_element_id($post_id);
  6.  
  7.         if(!empty($permalink_manager_uris[$original_post_id])) {
  8.             $permalink_manager_uris[$post_id] = $permalink_manager_uris[$original_post_id];;
  9.             update_option('permalink-manager-uris', $permalink_manager_uris);
  10.         }
  11.     }
  12. }
  13. add_action('icl_pro_translation_completed', 'pm_ate_inherit_permalink', 150, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement