Search Results :

×

Write WordPress Custom SQL Query | Query WordPress database

Write WordPress Custom SQL Query | Query WordPress database


Do you ever feel like you need more control over the WordPress database? If so, you're not alone. Many developers struggle with writing code for complex SQL queries to access and modify the WordPress database via APIs. Fortunately, there's a simpler solution: miniOrange Custom API for WordPress. With this powerful tool, you can quickly and easily query the WordPress database, fetch data from custom tables, and pass custom query parameters, all through a Graphical User Interface (GUI).

The WordPress database can be interacted using a custom SQL query. This can often be cumbersome and time-consuming. The solution to that is to use a custom API that can call tables and data customized to your needs without the need to write code. miniOrange Custom API for WordPress provides you with a Graphical User Interface (GUI) where you can write a custom SQL query to interact with the WordPress database. It enables you to call default tables or custom ones tailored to your requirements and get the data you need.

Download And Installation

  • You will require the Enterprise version of the Custom API for the WordPress plugin.
  • You will need an account with miniOrange.
  • You will also need to be logged in to WordPress as an administrator.

Custom API for WordPress
By miniOrange

Custom API for WordPress plugin allows you to create WordPress APIs / custom endpoints / REST APIs. You can Fetch / Modify / Create / Delete data with an easy-to-use graphical interface.

Know More

miniorange img Set up the Custom API for WordPress that allows you to call the WordPress database according to your needs:



      Follow the steps mentioned below to configure Custom API for WordPress to write a Custom GET SQL query in WordPress:

    • Log in to WordPress as an administrator.
    • Upload and activate the Enterprise version of Custom API for WordPress. You will see the following plugin dashboard.
    • WordPress custom SQL query
    • Go to Custom SQL API tab. You can name the API as you like and Select the GET HTTP method to fetch data from WordPress database.
    • WordPress custom SQL query
    • Note: You can also enable custom query parameters if you want to send a custom parameter in the API request.
    • Write the Custom SQL Query that you want to execute on the successful API call.
    • WordPress custom SQL query
    • Note: to send custom parameters, you can write the query like the following:
      SELECT * FROM wp_options WHERE option_id={{id_param}}; having _ is mandatory in the parameter name
    • Click Generate API and you will see the following screen.
    • WordPress custom SQL query
    • You can test the API by going to the new API endpoint as shown above.
    • Take a look at the response to our query as an example below:
    • WordPress custom SQL query

      Congratulations, you have successfully configured Custom API for WordPress to write a custom SQL Query to GET the data from the WordPress database!



      Follow the steps mentioned below to configure Custom API for WordPress to write a Custom POST SQL query in WordPress:

    • Log in to WordPress as an administrator.
    • Upload and activate the Enterprise version of Custom API for WordPress. You will see the following plugin dashboard.
    • WordPress custom SQL query
    • Go to Custom SQL API tab. You can name the API as you like and Select the POST HTTP method to write data into the WordPress database.
    • WordPress custom SQL query
    • Note: You can also enable custom query parameters if you want to send a custom parameter in the API request.
    • Write the Custom SQL Query that you want to execute on the successful API call.
    • WordPress custom SQL query
    • Note: to send custom parameters, you can write them like the following:
      INSERT INTO custom_table (ID, name, email, status) VALUES ('{{custom_param1}}','{{custom_param2}}','{{custom_param3}}','{{custom_param4}}'); having _ is mandatory in the parameter name
    • Click Generate API and you will see the following screen.
    • WordPress custom SQL query
    • You can test the API in postman by sending the custom parameters in Body. 1 in response means that API was successful.
    • WordPress custom SQL query

      Congratulations, you have successfully configured Custom API for WordPress to write a custom SQL Query to GET the data from the WordPress database!



      Follow the steps mentioned below to configure Custom API for WordPress to write a Custom PUT SQL query in WordPress:

    • Log in to WordPress as an administrator.
    • Upload and activate the Enterprise version of Custom API for WordPress. You will see the following plugin dashboard.
    • WordPress custom SQL query
    • Go to Custom SQL API tab. You can name the API as you like and Select the PUT HTTP method to update data in WordPress database.
    • WordPress custom SQL query
    • Note: You can also enable custom query parameters if you want to send a custom parameter in the API request.
    • Write the Custom SQL Query that you want to execute on the successful API call.
    • WordPress custom SQL query
    • Note: to send custom parameters, you can write them like the following:
      UPDATE custom_table SET ID='{{custom_param1}}',name='{{custom_param2}}',email='{{custom_param3}}',status='{{custom_param4}}' WHERE ID={{custom_param5}}; having _ is mandatory in the parameter name
    • Click Generate API and you will see the following screen.
    • WordPress custom SQL query
    • You can test the API in postman by sending the custom parameters in Body. 1 in response means that API was successful.
    • WordPress custom SQL query

      Congratulations, you have successfully configured Custom API for WordPress to write a custom SQL Query to GET the data from the WordPress database!



      Follow the steps mentioned below to configure Custom API for WordPress to write a Custom DELETE SQL query in WordPress:

    • Log in to WordPress as an administrator.
    • Upload and activate the Enterprise version of Custom API for WordPress. You will see the following plugin dashboard.
    • WordPress custom SQL query
    • Go to Custom SQL API tab. You can name the API as you like and Select the DELETE HTTP method to delete data from WordPress database.
    • WordPress custom SQL query
    • Note: You can also enable custom query parameters if you want to send a custom parameter in the API request.
    • Write the Custom SQL Query that you want to execute on the successful API call.
    • WordPress custom SQL query
    • Note: to send custom parameters, you can write them like the following:
      DELETE FROM custom_table WHERE ID={{custom_param1}}; having _ is mandatory in the parameter name
    • Click Generate API and you will see the following screen.
    • WordPress custom SQL query
    • You can test the API by going to the new API endpoint as shown above.
    • Take a look at the response to our query as an example below:
    • WordPress custom SQL query

      Congratulations, you have successfully configured Custom API for WordPress to write a custom SQL Query to GET the data from the WordPress database!



    Custom Query Parameter

    Parameters can help you create more dynamic and customizable reports. With parameters, you can pass data information in the API URL to the query and make your query response much more responsive. Use the following syntax to name the parameter: {{paramter_name}} _ is mandatory in parameter name.

    Need Help?

    Mail us on apisupport@xecurify.com for quick guidance(via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.

    miniorange img  Request a demo of the plugin


    Get Full-featured Trial



     Thank you for your response. We will get back to you soon.

    Something went wrong. Please submit your query again

    Write WordPress Custom SQL Query

    Need Help?

    Mail us on apisupport@xecurify.com for quick guidance(via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.

    Hello there!

    Need Help? We are right here!

    support
    Contact miniOrange Support
    success

    Thanks for your inquiry.

    If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com