JM Twitter Cards
[resolved] Problem with Description (5 posts)

  1. stephen_connolly
    Posted 2 years ago #


    I have the following hook setup in my theme's functions.php:

    function _jm_tc_strip_tags($content) {
    	return strip_tags($content);
    add_filter('jm_tc_get_excerpt', '_jm_tc_strip_tags');

    But this funtion is not being called. I based this solution from the following thread:




  2. tweetpressfr
    Plugin Author

    Posted 2 years ago #

    There's already a wp_strip_all_tags() in wp_trim_words(), no use to add your strip tags

  3. stephen_connolly
    Posted 2 years ago #

    Ok, thanks,

    I've just tried adding a filter (in my theme's funtions.php) as follows:

    add_filter('jm_tc_get_excerpt', 'wp_strip_all_tags($content)');

    and I tried:

    add_filter('jm_tc_get_excerpt', 'wp_strip_all_tags()');

    but filter is not being called.

    Any thought ?

  4. tweetpressfr
    Plugin Author

    Posted 2 years ago #

    It's already implemented in plugin because I use wp_trim_words() for the excerpt.

    Filters do not work that way in WP. You'd better do something like this:

    add_filter('jm_tc_get_excerpt', '_strip_my_tags');
    function _strip_my_tags( $content ) {
      return wp_strip_all_tags($content);

    But as I said it's already in the plugin (with the latest version)

  5. stephen_connolly
    Posted 2 years ago #

    Form some reason the function _strip_my_tags is not being executed, from my functions.php script in my theme's folder.

    Anyway, I got around the problem by making the following change in jm-twitter-card.php:

    $output .= '<meta name="twitter:description" content="' . jm_tc_remove_lb( wp_strip_all_tags($cardDescription) ) . '"/>' . "\n";

    Not ideal but works.

    Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • JM Twitter Cards
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic