Skip to content
  • Why WPGetAPI?
  • Examples
  • Pricing
  • Plugins
    • PRO Plugin
    • API to Posts Plugin
    • OAuth 2.0 Plugin
  • Docs
  • Support
    • Frequently Asked Questions
    • Feature Request
    • Support Ticket
  • account_circle
PRO Plugin
Howdy! How can we help you?
  • Introduction

    • Quick Start
    • Frequently Asked Questions
    • Will this work with my API?
    • Understanding API docs
    • Step by Step Example
  • Setup

    • Setup Page
    • Endpoint Page
    • Parameters - Query String
    • Parameters - Headers
    • Parameters - Body POST
    • Shortcode
    • Template Tag
    • Gutenberg Block
  • Connecting your API

    • API Key in Headers
    • API Key in Query String
    • Authentication & Authorization
  • Output API Data

    • Format API to HTML
    • Format API to HTML Table
    • Format API to Image Gallery
    • Format JSON Data
  • Integrations

    • Send form data to API
    • WPForms to API
    • Gravity Forms to API
    • Contact Form 7 to API
    • WooCommerce to API
    • WooCommerce API Product Sync
    • wpDataTables to API
    • Connect WordPress to OpenAI
    • Connect RapidAPI to WordPress
    • Connect Zoho CRM to WordPress
    • Page Builders (Elementor, DIVI)
    • Formidable Forms to API
    • Elementor Form to API
    • JetFormBuilder to API
    • Fluent Forms to API
    • WS Form to API
    • Ninja Tables to API
    • Easy Digital Downloads(EDD) API Product Sync
    • Ultimate Member Forms to API
  • Tips & Tricks

    • Filters & Action Hooks
    • Code Snippets Plugin
    • Troubleshooting
    • Code Snippets
  • PRO Plugin

    • Installation
    • Actions
    • Tokens
    • Caching
    • Nested data
    • Chaining API calls
    • Dynamic Variables
    • Format API to HTML
    • Call API on user registration
    • Using AJAX to trigger API call
    • Base64 Encoding
    • Licensing
    • Filters & Action Hooks
  • OAuth 2.0 Plugin

    • Installation
    • How it works
    • Grant Type - Client Credentials
    • Grant Type - Authorization Code
    • Licensing
  • API to Posts Plugin

    • Installation
    • Getting Started
    • Multiple Endpoints
    • Mapping Fields
    • Filters & Action Hooks
    • Pagination

If your API returns complex data or you need to format your data in a particular way, then you will most likely need to use the template tag method of outputting data.

Using the template tag is infinitely more flexible than the shortcode but can pose a few hurdles:

  1. You need to modify the code within your theme
  2. You need to understand FTP or cPanel to upload new/modified files
  3. It is prone to coding errors and 1 mistake can crash your entire website

Luckily there are a couple of methods we can use that allows us to run PHP code without having to worry about these 3 issues. Both methods involve using a PHP snippet plugin. You are free to use any snippet plugin that you like, but we have found the plugin below to work very well for what we need.

Plugin: “Code Snippets”

Plugin URL: https://wordpress.org/plugins/code-snippets/

With this plugin we can run either sitewide code or code that is output with a shortcode.

Option 1 – Create a shortcode snippet

This option will be useful for being able to add complex PHP code or complex formatting pages via a shortcode. It essentially turns complex PHP code into a shortcode.

Creating a shortcode snippet using this plugin:

  1. Click on Add New
  2. Select the Content (HTML) option
  3. Add your PHP code
  4. Click Save
  5. You will then see the shortcode that can be used in any widget, post or page.

Option 2 – Create sitewide snippet

This option will be useful for running code sitewide, such as when needing to run your API after a form submission like in these examples:

  • Using WPGetAPI with Contact Form 7
  • Using WPGetAPI with WPForms

Instructions for creating a sitewide PHP snippet using this plugin:

  1. Click on Add New
  2. Select the Functions (PHP) option
  3. Add your PHP code – the code is from here
  4. Click Save

This code will now run everywhere on your site, waiting for a form submission from Contact Form 7.

On this page
contact_support

Still not sure?

APIs can be daunting and sometimes downright confusing.

But we are here to help! Our support is amazing and we can assist you with any setup required and ensure your API integrations are a success!

Ask Us Anything

Connect your WordPress website to external APIs without writing a single line of code. Send data from WordPress to your API or display data from your API within WordPress.

Support

  • Documentation
  • Support Ticket
  • Refund Policy
  • Contact Us
  • About Us
  • Affiliates

Articles

  • Quick Start Guide
  • WooCommerce Orders to API
  • WooCommerce API Products Sync
  • Contact Form 7 to API
  • WPForms to API
  • Gravity Forms to API
  • WordPress to RapidAPI

WordPress API Plugins

  • Free WPGetAPI Plugin
  • PRO Plugin
  • API to Posts Plugin Plugin
  • OAuth 2.0 Authorization Plugin

© 2025 WPGetAPI. All Rights Reserved.

"*" indicates required fields

Name*
This field is for validation purposes and should be left unchanged.

Notifications