Back to Community

How to Disable Ad Inserter Ads on Your WordPress REST API

19 threads Sep 16, 2025 PluginAd inserter – ad manager & adsense ads

Content

If you're using the WordPress REST API to power a mobile app or other service, you may have noticed that Ad Inserter is injecting ad codes into your API responses. This is a common occurrence because the plugin processes content through standard WordPress filter hooks, which are often used by the REST API to deliver post content.

Fortunately, this is a simple issue to resolve without needing any premium upgrades. The solution involves using the plugin's powerful URL blacklisting feature to prevent ads from being inserted on any REST API endpoints.

Why This Happens

Ad Inserter works by hooking into standard WordPress processes. By default, it may process content delivered via the wp-json/wp/v2/ REST API endpoints because they use the same content filters as your public website. This results in ad code appearing in your API responses, which is typically not the desired behavior for a clean data feed.

How to Disable Ads on the REST API

You can easily stop ads from appearing in your REST API output by adding a URL pattern to the block's blacklist settings. Here’s how to do it:

  1. Open your WordPress dashboard and navigate to Ad Inserter → Settings.
  2. Click to edit the specific block that is inserting ads where you don't want them.
  3. Locate the Blacklists tab for that block.
  4. In the URLs text area, enter the following pattern: /wp-json/*
  5. Save the block's settings.

This URL pattern acts as a wildcard, telling Ad Inserter to disable the block on any URL that begins with /wp-json/. This effectively prevents the block from loading on all standard WordPress REST API endpoints.

This method uses the free version of Ad Inserter and does not require any custom code or a Pro license. It's a straightforward and effective way to ensure your API data remains clean and ad-free.

Checking Your Work

After applying this setting, clear any active caching on your site (if you use a caching plugin) and then manually check your API endpoint in a browser or tool like Postman. You should no longer see the ad code in the response.

By using the URL blacklist feature, you have fine-grained control over exactly where your ads are displayed, ensuring they only appear for your website visitors and not in your application data.

Related Support Threads Support