SHARE
TWEET

WPML ATE - inherit custom permalink

mbis Jun 1st, 2020 587 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top