Adding advertisements to a WordPress website often starts with a small code snippet inside a theme file. However, the setup can quickly become difficult to manage when a site needs different ads in the header, footer, sidebar, article content, or archive pages.
The Monetize Me WordPress plugin provides a central place to manage those advertisements. Instead of storing ad scripts in several theme templates, you can create ad categories, add sponsors, save advertising code, and control where each ad appears from the WordPress dashboard.
Theme developers can add simple shortcodes, action hooks, or PHP functions to their templates. Website administrators can then change the actual advertisement without editing the theme again.
This tutorial covers Monetize Me 3.0.0. It explains how to install and configure the plugin, create ad categories and sponsors, add advertisement code, configure placements, use shortcodes, and integrate the plugin into a WordPress theme.
What Is the Monetize Me Plugin?
Monetize Me is a WordPress advertisement-management plugin. It allows trusted administrators to save and display advertising or promotional code from the WordPress dashboard.
You can use the plugin to manage:
- Google AdSense code
- Advertising-network scripts
- Affiliate banners
- Direct sponsor banners
- Advertising iframes
- Custom promotional HTML
- Internal website promotions
The plugin separates advertisement management from theme development. The theme controls where an ad location exists, while Monetize Me controls which advertisement appears in that location.
Main Features of Monetize Me
- Create reusable ad categories.
- Create reusable sponsors or advertising networks.
- Store complete advertising scripts and HTML.
- Enable or disable individual advertisements.
- Display a random ad from matching advertisements.
- Display ads with the
[mmps]shortcode. - Display ads with the Advertisement Gutenberg block.
- Connect advertisements to WordPress theme action hooks.
- Display ads before or after archive loops.
- Display ads between archive items.
- Display ads before post content.
- Display ads after post content.
- Display ads between post paragraphs.
- Support posts, pages, and public custom post types.
- Add custom CSS classes to advertisement containers.
- Enable or disable the plugin’s frontend stylesheet.
- Use public PHP functions for custom development.
- Extend the plugin with WordPress actions and filters.
- Manage advertisements across a WordPress Multisite network.
- Keep settings after plugin deactivation or deletion.
How Monetize Me Organizes Advertisements
Monetize Me uses four main parts: categories, sponsors, advertisements, and placements.
Ad Categories
An ad category describes the location or purpose of an advertisement.
For example:
- Header Ads
- Footer Ads
- Sidebar Ads
- In-article Ads
- After Hero Ads
- Between Archive Items
A category does not identify the company that owns the advertisement. It identifies where or how the advertisement should be used.
Sponsors
A sponsor identifies the advertiser, company, affiliate program, or advertising network connected to an ad.
For example:
- General
- Google AdSense
- Media.net
- Amazon Associates
- Direct Advertiser
- Company A
Advertisements
An advertisement contains the actual monetization code. Each advertisement can be assigned to one category and one sponsor.
For example, an advertisement may use the following configuration:
| Name | Homepage Responsive AdSense Banner |
| Category | Header Ads |
| Sponsor | Google AdSense |
| Status | Enabled |
Placements
A placement connects a category and sponsor to a specific location on the website.
For example:
| Placement | After Header |
| Category | Header Ads |
| Sponsor | General |
When the theme runs the related action hook, Monetize Me finds an enabled advertisement that matches the selected category and sponsor.
Plugin Requirements
- WordPress 5.8 or later
- PHP 7.4 or later
- An administrator account on a single-site installation
- A network administrator account on WordPress Multisite
Because the plugin can save scripts, iframes, and raw advertisement HTML, only trusted administrators should have access to its settings.
How to Install Monetize Me
Install the Plugin from a ZIP File
- Sign in to your WordPress dashboard.
- Go to Plugins → Add New Plugin.
- Select Upload Plugin.
- Choose the Monetize Me ZIP file.
- Select Install Now.
- Wait for WordPress to complete the installation.
- Select Activate Plugin.
After activation, a new Monetize Me menu appears in the WordPress administration area.
Install the Plugin Through FTP
- Extract the plugin ZIP file on your computer.
- Upload the
monetize-mefolder to thewp-content/plugins/directory. - Open Plugins → Installed Plugins in WordPress.
- Find Monetize Me.
- Select Activate.
Using Monetize Me on WordPress Multisite
Monetize Me supports WordPress Multisite as a network-managed plugin.
- Open the WordPress Network Admin dashboard.
- Go to Plugins → Add New Plugin.
- Upload and install Monetize Me.
- Select Network Activate.
- Open Network Admin → Monetize Me.
On Multisite, Monetize Me uses one shared advertisement library and one shared placement configuration for the entire network. Individual subsites do not receive separate Monetize Me settings pages.
Default Categories and Sponsor
When Monetize Me is activated on a new installation, it creates several starter categories.
| Category | Slug |
|---|---|
| Header Ads | header-ads |
| Footer Ads | footer-ads |
| In-article Ads | in-article-ads |
| Sidebar Ads | sidebar-ads |
The plugin also creates a starter sponsor:
| Sponsor | Slug |
|---|---|
| General | general |
You can rename, edit, or remove these starter records.
If Monetize Me finds settings from an earlier installation, it keeps those settings instead of replacing them with a new empty configuration.
Recommended First-Time Setup
- Review or create ad categories.
- Review or create sponsors.
- Create at least one advertisement.
- Assign the advertisement to a category and sponsor.
- Enable the advertisement.
- Test the advertisement with a shortcode.
- Configure theme hooks or automatic placements.
- Clear all website and CDN caches.
- Test the website while logged out.
Following this order makes it easier to identify configuration problems.
How to Configure Ad Categories
Open Monetize Me → Ad Categories.
Create a New Category
- Select Add Category.
- Enter a category name.
- Enter a category slug, or leave the field empty to generate it automatically.
- Select Save Ad Categories.
For example:
| Category name | After Frontend Hero |
| Slug | after-frontend-hero |
A slug should contain lowercase letters, numbers, and hyphens. Avoid spaces and special characters.
Choose Clear Category Names
Use names that describe an advertisement location or purpose.
Good examples include:
- After Header Ads
- Before Footer Ads
- Article Inline Ads
- Homepage Hero Ads
- Archive Item Ads
- Sidebar Position One
Do not use an advertiser name as a category. Advertiser names should be created as sponsors.
Edit a Category
You can change a category name or slug without recreating all related advertisements. Monetize Me uses an internal category ID to maintain relationships.
However, changing the slug can affect existing shortcodes or custom PHP code.
For example, if you change:
in-article-ads
to:
article-inline-ads
You must update any shortcode or template code that still uses the old slug.
Delete a Category
Deleting a category does not delete the advertisements assigned to it. The plugin clears the deleted category reference from those advertisements and placements.
Those advertisements may stop appearing until you assign them to another category.
How to Configure Sponsors
Open Monetize Me → Sponsors.
Create a New Sponsor
- Select Add Sponsor.
- Enter the sponsor or advertising-network name.
- Enter a unique slug, or leave the slug field empty.
- Select Save Sponsors.
Examples include:
| Sponsor name | Suggested slug |
|---|---|
| Google AdSense | google-adsense |
| Media.net | media-net |
| Amazon Associates | amazon-associates |
| Direct Advertiser | direct-advertiser |
Why Sponsors Are Useful
Several advertisements can use the same category but belong to different sponsors.
| Advertisement | Category | Sponsor |
|---|---|---|
| AdSense Header Banner | Header Ads | Google AdSense |
| Company A Header Banner | Header Ads | Company A |
| General Header Promotion | Header Ads | General |
You can then request all Header Ads or only Header Ads that belong to a specific sponsor.
Delete a Sponsor
Deleting a sponsor does not delete its advertisements. The sponsor reference is removed from affected advertisements and placements.
Assign another sponsor before using those advertisements in sponsor-specific shortcodes or placements.
How to Create an Advertisement
Open Monetize Me → Ads, and then select Add Ad Item.
Advertisement Name
The advertisement name is used for administration only. Visitors do not normally see it.
Use a clear name such as:
- Homepage Header Responsive AdSense
- Article Inline Rectangle
- Company A Footer Banner
- Mobile Sidebar Sponsor
Ad Category
Select the category that describes where the advertisement should appear.
For example, an ad intended for article content may use the In-article Ads category.
Sponsor
Select the advertiser or advertising network connected to the ad.
For a general advertisement that is not linked to a specific company, you can use the default General sponsor.
Enabled Status
Only enabled advertisements can appear on the frontend.
Disable an advertisement when:
- A campaign has ended.
- An advertiser has paused a campaign.
- The advertising code needs testing.
- You want to keep the code for later use.
Disabling an advertisement is usually better than deleting it because the configuration remains available.
Monetization Code
Paste the complete trusted advertising code into the monetization-code field.
<script async src="https://example-ad-network.com/ad.js"></script>
<div class="example-ad-slot" data-slot="12345"></div>
Monetize Me preserves scripts, iframe markup, and provider-specific HTML. The plugin does not automatically add paragraph tags or line breaks because those changes could damage the advertising code.
Only paste code from a provider or advertiser you trust.
After completing the advertisement, select Save Ads.
How Random Ad Selection Works
When Monetize Me needs to display an advertisement, it follows these steps:
- Find all enabled advertisements.
- Filter them by the requested category.
- Filter them by the requested sponsor.
- Randomly select one matching advertisement.
- Render the selected advertisement.
Suppose three enabled advertisements use the following configuration:
Category: In-article Ads
Sponsor: General
The following shortcode may display any one of those three advertisements:
[mmps adcategory="in-article-ads" adsponsor="general"]
The selection happens when WordPress generates the page.
If the website uses full-page caching, the selected advertisement may remain inside the cached page until that cache expires or is cleared. This is normal for server-rendered advertisements.
How to Display Ads with the Shortcode
The Monetize Me shortcode is:
[mmps]
All shortcode attributes are optional.
| Attribute | Purpose |
|---|---|
adcategory | Filters advertisements by category ID, name, or slug. |
adsponsor | Filters advertisements by sponsor ID, name, or slug. |
classname | Adds one or more CSS classes to the outer advertisement container. |
Using slugs is normally the clearest and most reliable approach.
Display Any Enabled Advertisement
[mmps]
Because no category or sponsor is provided, any enabled advertisement may match.
Display an Advertisement from One Category
[mmps adcategory="in-article-ads"]
This selects an enabled advertisement from the in-article-ads category, regardless of sponsor.
Display an Advertisement from One Sponsor
[mmps adsponsor="general"]
This selects an enabled advertisement assigned to the General sponsor, regardless of category.
Filter by Category and Sponsor
[mmps adcategory="in-article-ads" adsponsor="general"]
Only enabled advertisements that match both values can appear.
Add Custom CSS Classes
[mmps adcategory="in-article-ads" adsponsor="general" classname="article-ad large-screen-ad"]
The additional classes are added to the outer Monetize Me container.
Use the Shortcode in WordPress Content
You can add the shortcode to:
- Posts
- Pages
- Shortcode blocks
- Compatible widgets
- Compatible page builders
- Template content that processes WordPress shortcodes
In the block editor, insert a Shortcode block and enter:
[mmps adcategory="in-article-ads" adsponsor="general"]
WordPress processes the shortcode and prints the returned advertisement automatically.
Use the Shortcode in a PHP Theme Template
The WordPress do_shortcode() function returns a string. It does not print that string automatically.
The following code does not display the advertisement:
<?php
do_shortcode( '[mmps adcategory="after-frontend-hero" adsponsor="general"]' );
?>
The correct implementation uses echo:
<?php
echo do_shortcode(
'[mmps adcategory="after-frontend-hero" adsponsor="general"]'
);
?>
You can also pass a custom class:
<?php
echo do_shortcode(
'[mmps adcategory="after-frontend-hero" adsponsor="general" classname="homepage-hero-ad"]'
);
?>
Use echo do_shortcode() when placing a shortcode directly inside a PHP template.
Do not use echo do_action() for Monetize Me action hooks. WordPress action functions do not return the rendered advertisement in the same way as a shortcode.
Use the Advertisement Gutenberg Block
Monetize Me includes a dynamic block named Advertisement.
- Edit a post, page, or block template.
- Open the block inserter.
- Search for Advertisement.
- Insert the Monetize Me Advertisement block.
- Select an ad category.
- Select a sponsor.
- Add an optional CSS class.
- Save or publish the content.
The block is rendered dynamically with PHP on the frontend.
Third-party scripts and iframes are not executed inside the block editor. The editor displays a safe configuration preview, while the live advertisement appears on the frontend.
How to Configure Ad Placements
Open Monetize Me → Placements.
The Placements screen contains four main sections:
- Frontend Styles
- Theme Hook Ads
- Archive Loop Ads
- Post Content Ads
Frontend Styles
The Load the Monetize Me frontend CSS file option controls whether the plugin loads its frontend stylesheet.
assets/css/frontend.css
The stylesheet provides basic spacing and centers the content inside the advertisement wrapper.
.monetize-me {
display: block;
margin-top: 20px;
margin-bottom: 20px;
}
.monetize-me .ad-wrapper {
display: flex;
justify-content: center;
margin-inline: auto;
}
Keep this option enabled when the active theme does not provide its own advertisement styles.
Disable it when your theme already styles the following elements:
.monetize-me
.monetize-me .ad-wrapper
Disabling the stylesheet does not disable advertisement output.
Theme Hook Ads
Theme Hook Ads connect WordPress action hooks to ad categories and sponsors.
Monetize Me supports the following theme hooks:
| Placement | Action hook |
|---|---|
| After header | monetize_me_after_header |
| Before footer | monetize_me_before_footer |
| Before archive start | monetize_me_before_archive_start |
| After archive end | monetize_me_after_archive_end |
| Between archive items | monetize_me_between_archive_item |
For each hook, the administrator can select:
- An ad category
- A sponsor
Selecting No category disables output for that placement.
Selecting Any sponsor allows any enabled advertisement from the selected category to match.
A placement cannot display anything until the active theme calls the related do_action() function.
Add an Advertisement After the Header
Open the theme file that contains the site header. In a classic theme, this is commonly header.php.
Add the following hook immediately after the header:
<?php do_action( 'monetize_me_after_header' ); ?>
To add a custom CSS class, pass it as the first hook argument:
<?php
do_action(
'monetize_me_after_header',
'site-header-ad'
);
?>
Next, open Monetize Me → Placements → Theme Hook Ads and configure the After header category and sponsor.
Add an Advertisement Before the Footer
Open the theme’s footer.php file and add:
<?php do_action( 'monetize_me_before_footer' ); ?>
With a custom CSS class:
<?php
do_action(
'monetize_me_before_footer',
'site-footer-ad'
);
?>
Then configure the Before footer placement from the Monetize Me settings.
Add Ads Before and After an Archive Loop
Archive templates may include the blog page, category archives, tag archives, author archives, search results, and custom post type archives.
Add the following hook before the loop begins:
<?php
do_action(
'monetize_me_before_archive_start',
'archive-start-ad'
);
?>
Add this hook after the loop finishes:
<?php
do_action(
'monetize_me_after_archive_end',
'archive-end-ad'
);
?>
A simple archive template may look like this:
<?php get_header(); ?>
<main id="primary" class="site-main">
<?php
do_action(
'monetize_me_before_archive_start',
'archive-start-ad'
);
?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : ?>
<?php the_post(); ?>
<?php
get_template_part(
'template-parts/content',
get_post_type()
);
?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php
get_template_part(
'template-parts/content',
'none'
);
?>
<?php endif; ?>
<?php
do_action(
'monetize_me_after_archive_end',
'archive-end-ad'
);
?>
</main>
<?php get_footer(); ?>
Display Ads Between Archive Items
The monetize_me_between_archive_item hook requires the current post object and the current one-based archive position.
Add the hook after rendering each item inside the archive loop:
<?php
global $wp_query;
$position = (int) $wp_query->current_post + 1;
do_action(
'monetize_me_between_archive_item',
get_post(),
$position,
'archive-list-ad'
);
?>
The $wp_query->current_post value starts at zero. Adding one converts it to a normal one-based position.
First post: 1
Second post: 2
Third post: 3
The third argument is optional. It adds one or more CSS classes to the outer advertisement container.
Configure Archive Loop Ads
After adding the hook to the theme, open Monetize Me → Placements → Archive Loop Ads.
Enable ads between archive items, and then choose an insertion method.
Random Interval Range
Set a minimum and maximum interval.
Minimum interval: 3
Maximum interval: 4
The plugin chooses the first target position between items 3 and 4. After an advertisement appears, the next target moves forward by another random value between 3 and 4.
This creates less predictable spacing than fixed positions.
Specific Item Positions
Choose the specific-position option and enter a comma-separated list:
3,7,10
The plugin displays advertisements after archive items 3, 7, and 10.
Only positive item numbers are used.
Archive Loop Ads do not automatically rewrite the active theme. The theme must include the monetize_me_between_archive_item action hook and pass the correct position.
Configure Automatic Post Content Ads
Post Content Ads use the standard WordPress the_content filter. They normally do not require a custom theme hook when the active theme displays content with the_content().
Open Monetize Me → Placements → Post Content Ads.
Enable automatic post content ads, and then select one or more locations:
- Before post content
- At the end of post content
- Between post paragraphs
Select Post Types
The plugin supports public post types, except attachments.
Available options may include:
- Posts
- Pages
- Products
- Portfolio items
- Documentation
- Other public custom post types
Select only the post types where automatic advertisements should appear.
Select the Category and Sponsor
Choose the category used for automatic content placements.
Ad Category: In-article Ads
Sponsor: General
You may also select Any sponsor.
Configure Paragraph Intervals
For advertisements between paragraphs, choose one of the available methods.
For a random interval:
Minimum paragraph interval: 3
Maximum paragraph interval: 4
For specific paragraph positions:
3,7,10
The second example inserts advertisements after paragraphs 3, 7, and 10, provided those paragraphs exist.
Conditions for Automatic Content Ads
Automatic content ads run only when the request meets the required WordPress conditions.
- The page is a singular post, page, or supported custom post type.
- The content belongs to the main WordPress query.
- The content is inside the main loop.
- The post type is enabled in the placement settings.
- The content is not password protected.
- The request is not an administrator screen.
- The request is not a feed.
- The request is not a WordPress REST API request.
A custom theme should use the normal WordPress content flow for this feature to work correctly.
Standard Frontend Markup
Monetize Me uses a standard wrapper structure for advertisements:
<div class="monetize-me in-article-ads">
<div class="ad-wrapper">
<!-- Selected advertisement code -->
</div>
</div>
The outer element may include:
- The main
monetize-meclass - The selected category slug
- Custom shortcode classes
- Custom block classes
- Custom hook classes
- Placement-specific classes
This structure makes it easier for theme developers to style all advertisements or one specific placement.
Style Monetize Me Ads in a Theme
Target every Monetize Me advertisement:
.monetize-me {
display: block;
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
Target only in-article advertisements:
.monetize-me.in-article-ads {
margin-block: 2rem;
}
Target the after-header placement:
.monetize-me-after-header {
padding-inline: 1rem;
}
Target a custom class passed through a theme hook:
.site-header-ad {
background: #f5f5f5;
padding-block: 1rem;
}
Avoid applying a fixed width directly to third-party advertising elements unless the advertising provider allows it. Fixed dimensions can break responsive ad units.
Render Ads Directly with PHP
Theme and plugin developers can use the Monetize Me rendering function instead of building a shortcode string.
monetize_me_render_ad(
$category,
$sponsor,
$classname,
$context
);
The function returns the advertisement markup as a string. It does not print it automatically.
<?php
if ( function_exists( 'monetize_me_render_ad' ) ) {
echo monetize_me_render_ad(
'in-article-ads',
'general',
'custom-theme-ad',
array(
'source' => 'theme_template',
)
);
}
?>
The returned value may contain trusted scripts, iframe code, or HTML. Do not pass the complete result through esc_html(), because that would convert the advertisement into plain text and stop it from working.
The function_exists() check prevents a fatal error if the theme remains active while Monetize Me is inactive.
Choose an Ad Category Dynamically
A theme can request a different category according to the current page.
<?php
if ( function_exists( 'monetize_me_render_ad' ) ) {
$category = is_front_page()
? 'header-ads'
: 'in-article-ads';
echo monetize_me_render_ad(
$category,
'general',
'context-aware-ad',
array(
'source' => 'theme_template',
'post_id' => get_the_ID(),
)
);
}
?>
Theme developers can combine Monetize Me with WordPress conditional functions such as:
is_front_page()is_home()is_singular()is_archive()is_category()is_search()is_post_type_archive()
This keeps advertising scripts out of the theme while still allowing the theme to request the right type of advertisement.
Render a Configured Placement with PHP
Monetize Me provides two placement functions.
Return Placement Markup
monetize_me_get_placement_ad(
$hook_name,
$context,
$classname
);
This function returns the advertisement markup.
<?php
if ( function_exists( 'monetize_me_get_placement_ad' ) ) {
$ad_html = monetize_me_get_placement_ad(
'monetize_me_after_header',
array(
'object' => get_queried_object(),
),
'custom-header-placement'
);
echo $ad_html;
}
?>
Print Placement Markup
monetize_me_render_placement(
$hook_name,
$context,
$classname
);
This function prints the advertisement directly.
<?php
if ( function_exists( 'monetize_me_render_placement' ) ) {
monetize_me_render_placement(
'monetize_me_after_header',
array(
'object' => get_queried_object(),
),
'custom-header-placement'
);
}
?>
Do not add echo before monetize_me_render_placement() because that function already prints its output.
Register Custom Theme Placements
Developers can use the monetize_me_theme_placements filter to register more placement hooks.
A small integration plugin or must-use plugin is a good place for this code because it keeps the integration separate from both the main theme and Monetize Me.
Create a plugin file such as:
wp-content/plugins/mytheme-monetize-me-integration/mytheme-monetize-me-integration.php
Add the following code:
<?php
/**
* Plugin Name: My Theme Monetize Me Integration
* Description: Adds custom Monetize Me placements for My Theme.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter(
'monetize_me_theme_placements',
function ( $placements ) {
$placements['mytheme_after_home_hero'] =
'header-ads';
$placements['mytheme_sidebar_position_one'] =
'sidebar-ads';
return $placements;
}
);
Activate the integration plugin. The custom placement hooks can then be connected to categories and sponsors in Monetize Me.
The theme can call the hooks like this:
<?php
do_action(
'mytheme_after_home_hero',
'after-home-hero-ad'
);
?>
Or:
<?php
do_action(
'mytheme_sidebar_position_one',
'sidebar-position-one-ad'
);
?>
This approach keeps responsibilities clear:
- The theme defines the available layout positions.
- Monetize Me selects and renders the advertising code.
- The administrator controls the active advertisement from WordPress.
Hide Ads for Logged-In Users
Developers can use the monetize_me_rendered_ad filter to prevent advertisements from appearing in selected situations.
<?php
add_filter(
'monetize_me_rendered_ad',
function ( $code, $ad, $context ) {
unset( $ad, $context );
if ( is_user_logged_in() ) {
return '';
}
return $code;
},
10,
3
);
?>
Returning an empty string prevents the advertisement wrapper from being generated.
You can adapt this method to hide ads for:
- Administrators
- Paid members
- Users with an ad-free subscription
- Selected page templates
- Selected post types
- Preview requests
Test conditional advertisement rules carefully when the website uses page caching.
Disable the Frontend Stylesheet with Code
The stylesheet can be disabled from the Placements screen or with a WordPress filter:
<?php
add_filter(
'monetize_me_should_enqueue_frontend_css',
'__return_false'
);
?>
This is useful when the active theme provides all advertisement styling.
Filter Supported Post Types
Developers can change which post types appear in the Post Content Ads settings.
<?php
add_filter(
'monetize_me_content_post_type_options',
function ( $post_types ) {
unset( $post_types['page'] );
return $post_types;
}
);
?>
The monetize_me_content_post_types filter can also change the selected post types while WordPress is running.
Important Public Functions
Category Functions
monetize_me_get_categories();
monetize_me_get_category( $identifier );
monetize_me_get_category_options();
The monetize_me_get_category() function can find a category by ID, name, or slug.
Sponsor Functions
monetize_me_get_sponsors();
monetize_me_get_sponsor( $identifier );
monetize_me_get_sponsor_options();
Advertisement Functions
monetize_me_get_ads( $enabled_only );
monetize_me_get_ad( $ad_id );
monetize_me_get_matching_ads( $category, $sponsor );
monetize_me_select_ad( $category, $sponsor, $context );
monetize_me_render_ad( $category, $sponsor, $classname, $context );
monetize_me_render_ad_record( $ad, $classname, $context );
Placement Functions
monetize_me_get_theme_placements();
monetize_me_get_placement_settings();
monetize_me_get_theme_hook_settings( $hook_name );
monetize_me_get_archive_placement_settings();
monetize_me_get_content_placement_settings();
monetize_me_get_content_post_type_options();
monetize_me_should_display_archive_ad( $position );
monetize_me_get_placement_ad( $hook_name, $context, $classname );
monetize_me_render_placement( $hook_name, $context, $classname );
Administrative and Frontend Functions
monetize_me_settings_page_url();
monetize_me_should_enqueue_frontend_css();
monetize_me_enqueue_frontend_css();
Important Developer Filters
Category and Sponsor Filters
monetize_me_get_categories
monetize_me_get_sponsors
monetize_me_starter_categories
monetize_me_starter_sponsors
Advertisement Selection and Rendering Filters
monetize_me_get_ads
monetize_me_matching_ads
monetize_me_selected_ad
monetize_me_ad_code
monetize_me_rendered_ad
Placement Filters
monetize_me_theme_placements
monetize_me_placement_settings
monetize_me_should_display_archive_ad
Post Type and Stylesheet Filters
monetize_me_content_post_type_options
monetize_me_content_post_types
monetize_me_should_enqueue_frontend_css
The plugin also runs the following actions:
monetize_me_categories_loaded
monetize_me_sponsors_loaded
monetize_me_loaded
Third-party integrations can use monetize_me_loaded after the main Monetize Me components have loaded.
Security Considerations
Monetize Me stores and renders raw monetization code. This is necessary for advertising scripts, but it also means that administrators must use the feature carefully.
A malicious script could:
- Redirect visitors to another website.
- Inject unwanted content.
- Track visitors without proper consent.
- Damage the website’s reputation.
- Violate advertising-network policies.
- Create privacy or security problems.
Protect administrator accounts with:
- Strong and unique passwords
- Multi-factor authentication
- Limited administrator access
- Regular WordPress updates
- Security monitoring
The plugin protects its settings forms with WordPress capabilities and security nonces. On Multisite, management is limited to users with network-level permissions.
Monetize Me is not a cookie-consent or privacy-management plugin. Website owners remain responsible for privacy laws, consent requirements, and advertising-network policies.
Troubleshooting: Why Is an Ad Not Displaying?
The Advertisement Is Disabled
Open Monetize Me → Ads and confirm that the advertisement is enabled.
The Category Does Not Match
The following shortcode requires an enabled advertisement assigned to the after-frontend-hero category:
[mmps adcategory="after-frontend-hero"]
Check the category slug for spelling differences, spaces, or an old slug that was changed.
The Sponsor Does Not Match
The following shortcode requires an enabled advertisement assigned to the General sponsor:
[mmps adsponsor="general"]
An advertisement assigned to another sponsor will not match.
The Advertisement Code Is Empty
An enabled advertisement with no monetization code produces no frontend output.
do_shortcode() Was Not Echoed
Incorrect:
<?php
do_shortcode(
'[mmps adcategory="header-ads"]'
);
?>
Correct:
<?php
echo do_shortcode(
'[mmps adcategory="header-ads"]'
);
?>
The Theme Hook Is Missing
Configuring a Theme Hook Ad does not automatically add that hook to the theme.
The theme must contain the related action call:
<?php
do_action( 'monetize_me_after_header' );
?>
Archive Ads Are Not Enabled
The between-item action hook also requires Archive Loop Ads to be enabled from the placement settings.
The Archive Position Is Incorrect
Monetize Me expects a one-based position.
$position = $wp_query->current_post + 1;
Passing the zero-based current_post value directly shifts all configured positions.
Automatic Content Ads Are Not Enabled
Enable automatic post content ads, choose at least one placement, select a category, and enable the required post types.
The Theme Does Not Use the_content()
Automatic content insertion depends on the normal WordPress content filter.
A custom template that prints raw post content without applying the_content filters may bypass automatic ad insertion.
A Category or Sponsor Was Deleted
Deleting a category or sponsor clears its reference from affected advertisements and placements. Assign the correct category or sponsor again.
The Page Is Cached
Clear the following caches:
- WordPress page cache
- Object cache
- Server cache
- Reverse-proxy cache
- Cloudflare or another CDN cache
- Browser cache
Test the page again in a private browser window.
An Ad Blocker Is Active
Browser extensions, private DNS services, security software, or network-level filters may hide advertising scripts.
Test with browser extensions disabled and inspect the page source to confirm whether Monetize Me generated its wrapper.
The Advertising Provider Did Not Return an Ad
If the Monetize Me wrapper exists but the ad area is empty, the provider may not have returned an advertisement.
Possible reasons include:
- The advertising account is not approved.
- The slot ID is incorrect.
- No advertisement is available for the visitor’s location.
- The page does not meet the provider’s content policy.
- User consent has not been collected.
- A browser or network tool blocked the request.
Recommended Theme Development Approach
A clean integration keeps theme responsibilities separate from advertisement-management responsibilities.
The theme should control:
- Page layout
- Available advertisement locations
- Action-hook placement
- Responsive styles
- Spacing and presentation
Monetize Me should control:
- Ad categories
- Sponsors
- Advertisement code
- Enabled and disabled status
- Random advertisement selection
- Placement mappings
- Automatic insertion rules
For example, a theme developer can add this stable location:
<?php
do_action(
'monetize_me_after_header',
'theme-header-ad'
);
?>
The website administrator can later change the category, sponsor, or advertising code without editing the theme.
This makes the theme easier to maintain and keeps monetization settings independent from future design changes.
Settings and Data Retention
Monetize Me does not delete its settings when the plugin is deactivated or deleted.
The following data remains stored:
- Ad categories
- Sponsors
- Advertisement items
- Advertisement enabled and disabled states
- Theme-hook mappings
- Archive placement rules
- Post-content placement rules
- The frontend stylesheet preference
This allows the plugin to be temporarily disabled for troubleshooting, maintenance, or updates without losing the existing configuration.
When the plugin is installed and activated again, it can continue using the saved settings.
If permanent data removal is required, a database administrator must manually remove the monetize_me_settings option.
Final Configuration Checklist
- Confirm that at least one category exists.
- Confirm that at least one sponsor exists.
- Create an advertisement with valid code.
- Enable the advertisement.
- Assign the correct category.
- Assign the correct sponsor.
- Test the advertisement with a shortcode.
- Add the required theme hooks.
- Pass a one-based position to archive item hooks.
- Enable automatic placements only where needed.
- Select the correct post types.
- Enable the plugin stylesheet or provide theme styles.
- Clear all website caches.
- Test the frontend while logged out.
- Confirm that all advertising code comes from trusted sources.
Conclusion
Monetize Me provides a practical way to manage WordPress advertisements without placing individual advertising scripts throughout a theme.
Administrators can organize advertisements by category and sponsor, enable or disable campaigns, configure automatic content insertion, and connect advertisements to theme locations.
Theme developers can provide stable advertisement locations with shortcodes, action hooks, and public PHP functions. The actual advertising code can then be changed from the WordPress dashboard without editing production template files.
This separation creates a cleaner and more maintainable WordPress setup. The theme controls presentation, while Monetize Me controls advertisement selection and delivery.
