PurabTech is technical blog for Programmer and Coders
Using custom sql query in wp_query function
People asked me fetching data from wordpress database with simple database query. You can use get_results() method for custom sql query in wp_query function.
Using custom sql query in wp_query function
Is this facility provided by wordpress API. Yes, that is provided by wordpress api. You just need to use the get_results() method. Here I am going to give some example about using the custom sql query in wp_query method.
You need to define the gobal $wpdb variable that important in your code. here is working example for fetching the posts.
So this is returning an entire HTML webpage for me via my AJAX call. I’m also aiming to make a standard JSON call with an SQL query like this. Any advice would be appreciated.
useful tip for wordpress plugin developer
So this is returning an entire HTML webpage for me via my AJAX call. I’m also aiming to make a standard JSON call with an SQL query like this. Any advice would be appreciated.
Use JSON API wordpress plugin for this.