receive a custom parameter with rest api

admin2025-06-04  0

I have a WordPress page that show some fields that are given in the query string

for example I can call the page with :

www.mysite/mypage?testparam=myvalue

and in the page I have this minimal code:

[insert_php]global $wp_query;if (isset($wp_query->query_vars['testparam'])){
$testparam= urldecode($wp_query->query_vars['testparam']);}
[/insert_php]

testparam is: [insert_php]var_dump ($testparam);[/insert_php]>

curl ";meta_key=test&_wp_json_nonce=4355d0c4b3&query_vars_hash=1"

So this is working well when using the standard web-way. Is there a way to pass the parameter also when requesting via the rest api ?

I tried with

curl ";testparam=testvalue"

But it seems that the testparm is nowhere to be found.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748994206a315458.html

最新回复(0)