Title: Does not insert into JSON API
Last modified: February 25, 2021

---

# Does not insert into JSON API

 *  Resolved [erikwestlund](https://wordpress.org/support/users/erikwestlund/)
 * (@erikwestlund)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/does-not-insert-into-json-api/)
 * I see in this post:
 * [https://wordpress.org/support/topic/ads-in-wordpress-rest-api-response-3/](https://wordpress.org/support/topic/ads-in-wordpress-rest-api-response-3/)
 * It says that the plugin inserts ads in the JSON API as long as “the_content” 
   filter is applied. It’s not showing up in our rendered content. I even added 
   a field to JSON (“ad_inserter” under wp_meta in the linked page), which return
   this:
 * apply_filters( ‘the_content’, get_the_content() )
 * Still, the ads do not show up in the JSON API.
 * I can get them to show up fine in regular rendered pages.
 * Am I missing something obvious here?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdoes-not-insert-into-json-api%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/does-not-insert-into-json-api/#post-14105013)
 * If I open the link you posted I get error:
 *     ```
       {
       code: "rest_not_authorized",
       message: "Authorization is required.",
       data: {
       status: 401
       }
       }
       ```
   
 * Please check this thread:
    [https://wordpress.org/support/topic/filter-on-the_content-doesnt-update-the-content-in-rest-api-results/](https://wordpress.org/support/topic/filter-on-the_content-doesnt-update-the-content-in-rest-api-results/)
 *  Thread Starter [erikwestlund](https://wordpress.org/support/users/erikwestlund/)
 * (@erikwestlund)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/does-not-insert-into-json-api/#post-14106617)
 * Sorry, that link is restricted.
 * My unsuccessful effort at a solution did exactly what was suggested. I registered
   a callback in REST that applied the filter “the_content” on the value of “get_the_content()”
   to no avail. The callback runs fine and returns the post but ad is not inserted
 * Is there anything else that should be done in the themes functions file? It’s
   a stripped down theme just for WP-API.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/does-not-insert-into-json-api/#post-14106967)
 * The plugin defines the following constants:
 *     ```
       define ('AI_PT_STATIC',                   1);
       define ('AI_PT_POST',                     2);
       define ('AI_PT_HOMEPAGE',                 3);
       define ('AI_PT_CATEGORY',                 4);
       define ('AI_PT_ARCHIVE',                  5);
       define ('AI_PT_SEARCH',                   6);
       ```
   
 * Can you try to define page type before calling the filter:
 *     ```
       global $ai_wp_data
       $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_POST;
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Does not insert into JSON API’ is closed to new replies.

 * ![](https://ps.w.org/ad-inserter/assets/icon-256x256.jpg?rev=1502039)
 * [Ad Inserter - Ad Manager & AdSense Ads](https://wordpress.org/plugins/ad-inserter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-inserter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-inserter/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-inserter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-inserter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-inserter/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Spacetime](https://wordpress.org/support/users/spacetime/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/does-not-insert-into-json-api/#post-14106967)
 * Status: resolved