K
K
KindOfHeaven2018-06-03 16:45:49
HTTP headers
KindOfHeaven, 2018-06-03 16:45:49

Why are GET/POST requests not working on WP?

Hello!
I send a search form (GET / POST tried both options) to another page, where, depending on the data received, it displays records (The page has a template installed)
However, with this transition, it shows the main page template
Help me figure it out

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pLavrenov, 2018-06-04
@pLavrenov

You can for example like this:

function add_query_vars_filter( $vars ){
       $vars[] = "название_переменной";
       $vars[] = "название_второй_переменной";
       return $vars;
  }
  add_filter( 'query_vars', 'add_query_vars_filter' );

And receive like this:
$var = (get_query_var('название_переменной')) ? get_query_var('название_переменной') : false;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question