PHP Function Output
This field available in PRO
version only.
Examples
How to get output of php function without arguments.
- Query
- Result
query {
user_logged_in: php_function_output(function: "is_user_logged_in")
}
{
"user_logged_in": true
}
How to get output of php function with static arguments.
- Query
- Result
query {
some_user_meta: php_function_output(function: "get_user_meta", arguments: [1, "some_key", true])
}
{
"some_user_meta": "<some_value>"
}
How to get output of php function with arguments based on global data variables.
- Query
- Result
query {
some_user_meta: php_function_output(function: "get_user_meta", arguments: [1, "[[[some_data_variable]]]", true])
}
{
"some_user_meta": "<some_value>"
}
How to get output of php function with arguments based on local data variables.
- Query
- Result
query {
queried_post{
ID @private
some_meta: php_function_output(function: "get_post_meta", arguments: ["{{{ID}}}", "some_meta_key", true])
}
}
{
"queried_post": {
"some_meta: "<some_value>"
}
}