E
E
Egor Dovydenko2021-02-22 11:16:06
WordPress
Egor Dovydenko, 2021-02-22 11:16:06

How to change php filtering link?

How to change the displayed url when filtering?
eestitalu.ee/shop/?min_price=0%3B1845
now the link is like this. I need to change the characters " %3B " between 0 and 1845 at the end.
Here is the code for the filter, as far as I understand:

if( isset( $_GET['min_price'] )   ) {  

    $min_max = explode(";", $_GET['min_price']);

    $args['meta_query'][] = [

      'key'     => '_price',

      'value'   => [(int)$min_max[0], (int)$min_max[1]],

      'type' => 'numeric', 

      'compare' => 'BETWEEN',

    ];  

  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Slashchinin, 2021-02-22
@slashinin

urldecode('eestitalu.ee/shop/?min_price=0%3B1845'); // Вернет eestitalu.ee/shop/?min_price=0;1845

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question