How to Add Ads to WordPress: Complete Guide
WordPress powers over 40% of websites. Here's how to add display ads to your WordPress site, whether you use a plugin or manual installation.
Methods to Add Ads to WordPress
| Method | Difficulty | Flexibility | Best For |
|---|---|---|---|
| Ad Plugin | Easy | High | Most users |
| Theme Options | Easy | Limited | Theme-specific |
| Manual Code | Medium | Maximum | Developers |
| Widget Areas | Easy | Medium | Sidebar ads |
Recommended Plugins
| Plugin | Free Version | Ease of Use |
|---|---|---|
| Ad Inserter | Yes | Excellent |
| Advanced Ads | Yes | Very Good |
| WP QUADS | Yes | Good |
Step 1: Install the plugin
- Go to Plugins → Add New
- Search "Ad Inserter"
- Install and activate
Step 2: Configure ad placement
- Go to Settings → Ad Inserter
- Paste your Adsterra code in Block 1
- Choose placement:
- Before post
- After paragraph (recommended)
- After content
Step 3: Set conditions
- Which post types
- Which pages
- Exclude categories if needed
Best Ad Inserter Settings
| Setting | Recommended |
|---|---|
| Automatic insertion | After paragraph 2-3 |
| Device type | Desktop and Mobile |
| Alignment | Center |
| Margin | 15px top/bottom |
Adding Ads to Sidebar
Step 1: Get your ad code
- Log into Adsterra
- Create ad unit (300x250 recommended for sidebar)
- Copy the code
Step 2: Add widget
- Go to Appearance → Widgets
- Find "Custom HTML" widget
- Drag to Sidebar area
- Paste ad code
- Save
Widget Placement Options
| Location | Best Size | Notes |
|---|---|---|
| Sidebar Top | 300x250 | High visibility |
| Sidebar Middle | 300x600 | More impressions |
| Footer | 728x90 | Lower value |
Using Theme Hooks
Many themes have built-in ad areas:
Common theme options:
- Header ad area
- Before/after content
- Sidebar widgets
- Footer areas
Theme-Specific Instructions
GeneratePress:
- Go to Appearance → Elements
- Create new element for ads
- Choose hook location
Astra:
- Use Astra Custom Layouts
- Or Header Footer plugin
Kadence:
- Use Kadence Elements
- Built-in ad areas
Method 4: Manual Code Insertion
Editing Theme Files (Advanced)
In functions.php:
Add hooks to insert ads automatically at specific points in your content.
In single.php:
Place ad code directly where you want ads to appear.
Using Child Theme
Always use a child theme for:
- Theme file modifications
- Survival through updates
- Safe customization
Optimal Ad Placements for WordPress
Blog Post Layout
Recommended setup:
| Location | Ad Type | Size |
|---|---|---|
| After paragraph 1 | Banner | 300x250 |
| After paragraph 3-4 | Native | Responsive |
| Sidebar | Banner | 300x250 |
| After content | Banner | 728x90 |
| Location | Ad Type | Size |
|---|---|---|
| Header | Banner | 728x90 |
| Sidebar | Banner | 300x600 |
| Footer | Banner | 728x90 |
Responsive Ad Units
Use responsive sizes:
- 300x250 works on all devices
- 320x50 for mobile header
- 320x100 for mobile sticky footer
Mobile-Specific Settings
In Ad Inserter:
- Create separate mobile blocks
- Set device type to Mobile
- Use appropriate sizes
Common WordPress Ad Issues
Issue 1: Ads Not Showing
Causes and fixes:
| Cause | Solution |
|---|---|
| Caching | Clear cache |
| Ad blocker | Test in incognito |
| Code error | Check for typos |
| Theme conflict | Test with default theme |
Causes and fixes:
| Cause | Solution |
|---|---|
| Ad size too large | Use smaller/responsive |
| No container | Wrap in div |
| CSS conflict | Add custom CSS |
Causes and fixes:
| Cause | Solution |
|---|---|
| Too many ads | Reduce quantity |
| No lazy loading | Enable lazy loading |
| Heavy ad scripts | Use async loading |
Speed Tips
| Tip | Impact |
|---|---|
| Lazy load ads | High |
| Limit ad count | Medium |
| Use async scripts | Medium |
| Cache properly | High |
For WP Rocket, W3 Total Cache, etc.:
- Exclude ad scripts from minification
- Don't cache ad containers
- Enable lazy loading separately
WordPress Multisite
Adding Ads Across Network
Options:
- Network-activated plugin
- Must-use plugin
- Theme functions
Site-Specific Ads
- Use conditional logic
- Different ad units per site
- Separate reporting
Security Considerations
Safe Ad Implementation
| Do | Don't |
|---|---|
| Use trusted networks | Add random ad scripts |
| Verify ad code | Modify ad code |
| Keep plugins updated | Ignore security updates |
| Backup before changes | Edit live without backup |
In WordPress
Using Analytics:
- Set up Google Analytics
- Track ad clicks (advanced)
- Monitor page performance
In Adsterra
- Track by placement
- Compare devices
- Analyze geography
Step-by-Step Setup
Day 1: Preparation
- [ ] Sign up for Adsterra
- [ ] Get approved
- [ ] Install Ad Inserter plugin
Day 2: Basic Setup
- [ ] Create 3 ad units in Adsterra
- [ ] Configure Ad Inserter blocks
- [ ] Test on live site
Day 3: Optimization
- [ ] Check mobile display
- [ ] Verify caching compatibility
- [ ] Test page speed
Week 1 Review
- [ ] Check ad impressions
- [ ] Verify revenue
- [ ] Adjust placements if needed
Recommended Plugin Combinations
For Beginners
- Ad Inserter (free)
- LiteSpeed Cache
- Default theme
For Advanced Users
- Advanced Ads Pro
- WP Rocket
- GeneratePress/Astra
For Maximum Control
- Custom code
- Child theme
- Performance plugins
WordPress makes ad implementation easy. Whether you use plugins or code, you can be earning within an hour of starting.

