I'm trying to obtain for products and products category the following permalinks structures: https://mm.mtgeeks.com/product-name.html https://mm.mtgeeks.com/parent-category-name.html https://mm.mtgeeks.com/parent-category-name/subcategory-name.html
In order to obtain this I have modified the permalink using the following filters and actions:
add_filter( 'request', 'change_requerst_vars_for_product_cat' ); add_filter( 'term_link', 'term_link_filter', 10, 3 ); add_filter( 'post_type_link', 'wpp_remove_slug', 10, 3 ); add_action( 'pre_get_posts', 'wpp_change_request' ); add_action( 'create_term', 'mee_new_product_cat_edit_success', 10, 2 );//fix 404 errors add_action('init', 'mee_product_category_rewrite_rules'); add_action('wp_insert_post', 'mt_woo_new_product_post_save');//fix 404 errors add_action('init', 'mt_woo_product_rewrite_rules');
After updating the permalinks from the wordpress admin, on the frontend I obtain the needed permalinks structure, but on the backend I have only one issue.
When trying to do modifications to products I get the following message displayed by google chrome: "This page isn’t working mm.mtgeeks.com is currently unable to handle this request. HTTP ERROR 500"
After doing some debugging in the wordpress core, I have observed that the product updating process remains blocked in the function wp_insert_post from wp-includes/post.php at line 3962 (do_action( 'wp_insert_post', $post_ID, $post, $update );)
How can I fix this issue? For which purposes is this line of code used?
I've observed that if this line of code is commented out, the updating process is working correctly.