You should hook add_rewrite_rule()
into init
Assuming http://local/rieltplus/
is your homepage, and category/catalog/
is a category archives, this should work:
add_action('init', function() {
add_rewrite_rule(
'category/catalog/([^/]+)?$',
'index.php?category_name=catalog&type=$matches[1]&price_min=1000&price_max=2000&area_min=5&area_max=50&room_num=5&etage=2&plan=old',
'top'
);
});
If you want to make that available to any category then mention it in the comments.
By the way, local/rieltplus/category/catalog/TYPE&price_min
is not a valid URL, unlike local/rieltplus/category/catalog/TYPE?price_min
or local/rieltplus/category/catalog/TYPE/?price_min
..
To get the type
variable, use get_query_var( 'type' )
but first add it to the main query:
add_filter('query_vars', function($vars) {
$vars[] = "type";
return $vars;
});
You should flush the permalink structure by saving your permalink structure in the settings > permalinks
screen or using flush_rewrite_rules()
ONLY ONCE.
Edit – As per your other question in the comments
add_action('wp', function() { // this will work as long as GET type is the first is the query string
if( "catalog" === get_query_var( "category_name" ) && isset( $_GET["type"] ) ) {
if( ! empty( $_GET["type"] ) ) {
$type = strval( $_GET["type"] );
$url = $_SERVER["REQUEST_URI"];
$url = str_replace( array( "?type={$type}&", "?type={$type}" ), "{$type}?", $url );
$url = str_replace( "?&", '?', $url );
wp_redirect( $url );
exit;
}
}
});