[Resolved] How to use views PHP API function get_view_query_results with third party plugin
This thread is resolved. Here is a description of the problem and solution.
Problem:
How to use views PHP API function get_view_query_results with third party custom plugin
Solution:
you should try to use the WordPress standard hook wp_loaded that will allow you to use the view's PHP API function with custom plugin in this case.
On my view hidden link
I try to query the "Affichages prévisions" by taxonomie signe and type horoscope. And i have to use it with api.
The problem is the filters doesn't work.
You can see the result of the print_r here : hidden link
here is my code :
$args = array(
'wpvtypehoroscope' => "week-end",
'signe' => "bélier",
);
$vue_affichage = get_view_query_results(30829, $args);
print_r($vue_affichage);
Maybe i have made an mistake. But i have tried lot of thing.....
Hello. Thank you for contacting the Toolset support.
Well - I need to review on your site how you configured your view and on which PHP template you added the code you shared.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
And, we can even see it is not working if wee add argument id publication.
I have make lot of tests. ...
Even if i make the view as my first picture it is not working.
Nevertheless if i manage the id publication like my second picture it is working. But the same argument passed in api doesn't work.
I am bit surprised with your answer. Of course if we change all, it could be work, i have also told you that the view work on the page when i used it without api.
My plugin is clean and easy. I call a view and the view give a bad answer 🙁
What is minimum install ? as you can see i almost use Toolset without other plugin....
But beacause i have to fix this problem, and even i have big trafic right now, i have turn off all plugins and turn on TwentyNineteen Theme and the problem stay the same.
I think i i put my fonction in a shortcode it would work , but i can use shortcode because i need a empty page juste with json code.
As i expected, with a shortcode it works perfectly. hidden link
My problem is i need an empty page with just json result, i understand for to that i can not use shortcode, i have to use plugin and call the view by the same way i have shown you.
I really think to use the api view toolset with parameters we have to make some WP includes before, but which one.... that is the question.