Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pm_regenerate_custom_permalinks($post_id) {
- global $permalink_manager_uris;
- if(!empty($permalink_manager_uris)) {
- $default_uri = Permalink_Manager_URI_Functions_Post::get_default_post_uri($post_id);
- if($default_uri) {
- if(!empty($_POST['custom_uri'])) {
- $_POST['custom_uri'] = $default_uri;;
- }
- $permalink_manager_uris[$post_id] = $default_uri;
- update_option('permalink-manager-uris', $permalink_manager_uris);
- }
- }
- }
- function pm_update_post_terms($object_id, $terms, $tt_ids, $taxonomy) {
- // Trigger only for selected taxonomies
- if(!in_array($taxonomy, array('product_cat'))) { return; }
- // Trigger only for selected post types
- $post = get_post($object_id);
- if(!empty($post->post_type) && !in_array($post->post_type, array('product'))) { return; }
- pm_regenerate_custom_permalinks($object_id);
- }
- add_action('set_object_terms', 'pm_update_post_terms', 9, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement