$_GET vs get_query_var()

Question

Is there is any advantage of using the get_query_var() over $_GET()?

I have tried like this

myurl?posts_per_page=2

and the results are totally different

echo $_GET['posts_per_page'] // output is 2
echo get_query_var('posts_per_page') //output is 10

I have not added ‘posts_per_page’ to query var list using action so where does this 10 is coming up from?

0
Alt C 3 weeks 2022-08-31T21:18:40-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse