Back to Community

Resolving Common PHP Errors and Warnings in Ad Inserter

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

Content

If you're using the Ad Inserter plugin and encountering PHP errors, warnings, or fatal errors in your server logs, you're not alone. These issues are a common source of confusion and can often be resolved with a few specific steps. This guide will walk you through the most frequent errors and their solutions, based on community reports and resolutions.

Common Error Types and Their Causes

The errors typically fall into a few categories:

  • Deprecation Notices: These occur when updating to newer PHP versions (like 8.1 or 8.2) and the plugin uses functions that are now deprecated. Examples include preg_match(): Passing null to parameter #2 ($subject) or strtolower(): Passing null to parameter #1 ($string).
  • Undefined Array Key Warnings: Warnings like PHP Warning: Undefined array key 25 indicate the plugin is trying to access an array element that doesn't exist. This is often related to specific block configurations.
  • Fatal Errors (Memory Exhaustion/Timeouts): Errors such as Allowed memory size of... bytes exhausted or Maximum execution time of... seconds exceeded suggest the plugin's processes are consuming excessive server resources, potentially due to complex insertion rules or PHP code within blocks.
  • Corrupted Settings Errors: Errors like unserialize(): Error at offset... point to corruption within the plugin's settings data stored in your WordPress database.
  • Translation Loading Warnings: Alerts that translation loading was triggered too early are related to how the plugin loads its text domains.

Step-by-Step Troubleshooting Solutions

1. Update to the Latest Development Version

For many errors, especially deprecation notices and undefined array key warnings, the 'Ad Inserter – Ad Manager & AdSense Ads' team often releases fixes in development versions before they are pushed to the official repository. A common solution found in the threads is to manually install the latest development build.

How to do it:

  1. Download the development version from: https://downloads.wordpress.org/plugin/ad-inserter.zip
  2. In your WordPress dashboard, navigate to Plugins → Add New.
  3. Click Upload Plugin and upload the ZIP file you just downloaded.
  4. WordPress will ask if you want to replace the current version. Confirm to proceed with the update.
This simple step has resolved a significant number of reported issues.

2. Check for Invalid PHP Code in Blocks

Many warnings that reference eval()'d code are a direct result of invalid PHP code being entered into an Ad Inserter block. The plugin executes this code, and any syntax errors will generate warnings.

How to do it:

  1. Review all blocks where you have enabled the PHP code option.
  2. Carefully check the code for any syntax errors, missing semicolons, or incorrect variable names.
  3. Temporarily disable PHP code in blocks one by one to identify which one is causing the error.

3. Reset Corrupted Settings

If you are encountering unerialize errors, your plugin settings stored in the database (ad_inserter option in the wp_options table) may have become corrupted.

How to do it:

  1. Go to Ad Inserter → Settings → Maintenance.
  2. Click the Reset All Settings button.
  3. Warning: This will erase all your current Ad Inserter configurations and restore default settings. You will need to reconfigure your ad blocks afterwards. If you have a database backup from before the errors started, restoring the ad_inserter option from that backup is a preferable alternative.

4. Increase PHP Memory Limit

Fatal errors related to exhausted memory are often a server configuration issue rather than a direct plugin bug. WordPress and its plugins can be memory-intensive.

How to do it: Edit your WordPress wp-config.php file and add the following line above the /* That's all, stop editing! Happy publishing. */ comment:

define( 'WP_MEMORY_LIMIT', '256M' );
If 256M does not work, try increasing it to 512M. If increasing the memory limit causes crashes, the issue may be more complex and require further investigation.

5. Enable Remote Debugging for Specific Help

For persistent or unique errors, the plugin's support often requests that users enable remote debugging. This allows them to see detailed information about the error in the context of your website.

How to do it:

  1. Follow the guide on the WordPress.org support forum: Ad Inserter Support Forum - Before you ask for help.
  2. This typically involves adding specific code snippets to your wp-config.php file.
  3. Once enabled, you can share your site URL on support forums for more targeted assistance.

When the Error Might Not Be Ad Inserter

It's important to note that some fatal errors, such as Unsupported operand types: string % int in .../wp-includes/pomo/plural-forms.php, are related to core WordPress files or other plugins (like SEO by Rank Math in the provided threads). If the error stack trace does not point to a file within the /wp-content/plugins/ad-inserter/ directory, the issue likely lies elsewhere in your WordPress installation.

Conclusion

Most PHP errors related to the Ad Inserter plugin are not show-stopping bugs but rather notices and warnings that can be systematically troubleshooted. The most effective first steps are always to install the latest development version of the plugin and review any custom PHP code you have implemented in your blocks. For more complex issues, increasing memory limits or resetting settings often resolves the underlying problem.

Related Support Threads Support