The default page number prefix of WordPress page turning link is/page/2/, which can be customized through the following code, such as/mylink/2/. Add code to the current topic function template functions.php:
function zm_rewrite_rules() { global $wp_rewrite; $wp_rewrite->author_base = 'autors';// Author Archive Flip Prefix $wp_rewrite->search_base = 'search';// Search Flip Prefix $wp_rewrite->pagination_base = 'mylink';// Page number prefix $wp_rewrite->flush_rules(); } add_action( 'init', 'zm_rewrite_rules' );
Modify the names of autors, search, and mylink respectively.
If it does not take effect, the open link is displayed as 404, and you can save the fixed link settings in the WP background.
The above code may affect operation efficiency.
function zm_base() { $GLOBALS['wp_rewrite']->pagination_base = 'mylink'; } add_action( 'init', 'zm_base' ); function zm_rewrite( $rules ) { $new_rules = array( 'obchod/mylink/([0-9]{1,})/?$' => ' index.php? post_type=product&paged=$matches[1]', ); $rules = array_merge( $new_rules, $rules ); return $rules; } add_filter( 'rewrite_rules_array', 'zm_rewrite' );
Modify the mylink name.
After adding code, you need to save the fixed link settings in the WP background, or they will not take effect.
Conclusion: It is recommended to use Code 2 to run more efficiently.
As for why to customize the link, in addition to personalization, it can increase the difficulty of malicious collection.
Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!