Forums

[resolved] [Plugin: All in One Adsense and YPN] AIO Adsense and Headspace 2 error when using %%excerpt%% (2 posts)

  1. transphorm
    Member
    Posted 3 years ago #

    Okay this took me an ungodly amount of time to debug. I hope it can help some of you. Adsense fails to load when running Headspace 2 using the %%excerpt%% tag.

    The bug lies here:

    headspace2/models/inline_tags.php
    Line #207
    $excerpt = apply_filters ('the_content', substr ($post->post_content, 0, 1000));

    Changed it to:
    $excerpt = substr ($post->post_content, 0, 1000);

    I don't know the benefits of using apply_filters but the above code will result in AIO working and headspace2 still creating the necessary meta description tag.

    I see apply_filters used quite a bit so why it errors out here is beyond me. Reading up on apply_filters I guess it's supposed to run the filter after all hooks have completed.

    However, AIO was receiving null from 'the_content' hook thus substr would not work for the adsense ads. Whew!

  2. transphorm
    Member
    Posted 3 years ago #

    Forgot to add

    1. Setting the priority didn't work for add_filter
    2. I run another plugin I created myself that uses the 'the_content' filter and everything runs fine. It receives data.
    3. I have been able to reproduce this problem on two seperate blogs that I run

Topic Closed

This topic has been closed to new replies.

About this Topic