您可以尝试以下操作:
方法1:
我们可以通过
the_post 操作,在主循环中:
add_action( \'loop_start\', \'wpse_141253_loop_start\' );
function wpse_141253_loop_start( $query )
{
    if( $query->is_main_query() )
    {
        add_action( \'the_post\', \'wpse_141253_the_post\' );
        add_action( \'loop_end\', \'wpse_141253_loop_end\' );
    }
}
function wpse_141253_the_post()
{
    static $nr = 0;
    if( 0 === ++$nr % 4 )
        echo \'<div> -------- MY AD HERE ------- </div>\';
}
function wpse_141253_loop_end()
{
    remove_action( \'the_post\', \'wpse_141253_the_post\' );   
}    
 方法2:我们也可以通过
the_content 过滤器,在主回路中:
add_action( \'loop_start\', \'wpse_141253_loop_start\' );
function wpse_141253_loop_start( $query )
{
    if( $query->is_main_query() )
    {
        add_filter( \'the_content\', \'wpse_141253_the_content\' );
        add_action( \'loop_end\', \'wpse_141253_loop_end\' );
    }
}
function wpse_141253_the_content( $content )
{
    static $nr = 0;
    if( 0 === ++$nr % 4 )
        $content .= \'<div>------- MY AD HERE -------</div>\';
    return $content;
}
function wpse_141253_loop_end()
{
    remove_action( \'the_post\', \'wpse_141253_the_content\' );   
}    
 希望您可以根据自己的需要进行修改。