WordPress.org

Ready to get started?Download WordPress

Forums

Share Buttons by AddThis
[Plugin: AddThis] Bug! inserting into metatag content via get_the_excerpt/the_content (4 posts)

  1. ade11
    Member
    Posted 2 years ago #

    The plugin "Facebook Open Graph Meta in WordPress" has this line of code in its insert_fb_in_head() function;

    <meta property="og:description" content="<?php echo
    strip_tags(get_the_excerpt($post->ID)); ?>"/>

    Probably other plugins will use the same method.

    If there is no excerpt, or if it is a page, wordpress of course defaults to using an extract of "the_content", which is unfortunately in this case filtered into by AddThis, which echo's itself into the metatag and breaks things (i.e. content="<script ... ").

    In addthis_social_widget.php, this;
    add_filter('the_title', 'at_title_check');

    will call this;
    add_filter('the_content', 'addthis_script_to_content');

    which will call <b>addthis_output_script()</b>, which actually echo's the script there and then, rather than appending it or returning it.

    commenting either of those filters will fix the problem, but we'd prefer a fix from the authors.

    many thanks!

    http://wordpress.org/extend/plugins/addthis/

  2. _mjk_
    AddThis Samurai
    Plugin Author

    Posted 1 year ago #

    Sorry for the delay -- if you turn off AddThis's inclusion in excerpts (in the Advanced tab), does that resolve this problem?

    Best,
    Matt

  3. ade11
    Member
    Posted 1 year ago #

    No!

  4. _mjk_
    AddThis Samurai
    Plugin Author

    Posted 1 year ago #

    Thanks! Could you upgrade to the latest plugin version? The title filter was removed in our release a month or so ago, probably not long after you posted initially. I think that should be fine for now. Sorry for not realizing that immediately!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic