Support » Plugin: Share Buttons by AddThis » [Plugin: AddThis] Bug! inserting into metatag content via get_the_excerpt/the_content

  • 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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry for the delay — if you turn off AddThis’s inclusion in excerpts (in the Advanced tab), does that resolve this problem?



    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: AddThis] Bug! inserting into metatag content via get_the_excerpt/the_content’ is closed to new replies.