How to change pagination base from slash to query form?

Can this function...

function custom_pagination_base() {
global $wp_rewrite;
$wp_rewrite-pagination_base = 'p';
$wp_rewrite-flush_rules();
}
add_action( 'init', 'custom_pagination_base' );

...be somehow used to change the from of the url from "page/2/" not to "p/2/" but to "?p=2"?

Topic url-rewriting permalinks pagination Wordpress

Category Web


I am not entirely sure what you are asking but that ?p= pattern is a raw query string. That is, that is what you get without pretty permalinks at all.

Go to Settings->Permalinks in wp-admin and select the default permalinks. Save and you are done. You don't need any other function. If that doesn't solve it you need to rewrite your question so that it is more clear.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.