最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Issue with wp_insert_post when modifying permalinks with “.html” extension

programmeradmin1浏览0评论

I'm trying to obtain for products and products category the following permalinks structures: .html .html .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 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.

I'm trying to obtain for products and products category the following permalinks structures: https://mm.mtgeeks/product-name.html https://mm.mtgeeks/parent-category-name.html https://mm.mtgeeks/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 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.

Share Improve this question edited Mar 25, 2019 at 11:47 mrben522 1,6931 gold badge12 silver badges17 bronze badges asked Mar 24, 2019 at 20:38 MikaDevMikaDev 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Hmm, I would use the Permalink Manager Lite plugin (free). or it's PRO version ($39): https://permalinkmanager.pro/ Makes life easier :)

发布评论

评论列表(0)

  1. 暂无评论