[cs_content_seo] appears when sharing a page

When I share a page for example https://wijzer.nu/test-2-wijzer-doet/ in Whatsapp or on Facebook especially on new pages there comes a text in the shared posts that begins with [cs_content_seo].

How to remove this text or prevent the this text will be posted for every one who wants to share a page?

Hi Vink,

Thank you for reaching out to us. This usually happens due to a conflict, please check for the following first:

  1. Ensure everything is up to date according to our version compatibility list at https://theme.co/docs/version-compatibility. Please follow the best practices when updating your theme and plugins. See https://theme.co/docs/product-updates for more details.

  2. If you’re using a caching plugin, clear all caches including browser cache then deactivate your caching plugin and other optimization plugins. If you’re using a CDN, please clear the CDN’s cache and disable optimization services.

  3. Test for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

  4. If you’re using child theme, deactivate it and switch to parent theme.

If you still have problems kindly get back to us with the result of the steps above and URL/User/Pass of your WordPress dashboard using the Secure Note functionality of the post to follow up the case.

Thanks.

Hello Nabeel, thanks for your reply. I tried it all:

  1. all up to date
  2. no cache plugin
  3. de activated all plugins (except cornerstone)
  4. switch to main x-theme

Still [cs_content_seo] code is being displayed in shared posts. only in Cornerstone 2 pages. not on home page. At home page a correct text appears in shared posts and Whatsapp etc.

Hi Vink,

Please share site URL and credentials inside a secure note so we can check your setup. We need to see difference on your page settings.

Hi Vink,

The [cs_content_seo] is a new feature to make texts and other information visible from 3rd party plugins. It should be automatically removed once the excerpt is generated, it’s usually use for sharing description or meta description.

This means the sharing feature that’s currently in your site is not utilizing the get_excerpt() where usually the short description is pulled.

image

Would you mind providing your FTP login credentials as well? I like to try something first, then I may add this as a bug once confirmed. I tried the free version of jetpack, but seems need to connect it first to Wordpress.com as I’m seeing different setup.

I like to remove this for testing

cornerstone\includes\integrations\conflict-resolution.php:
     if ( defined( 'JETPACK__VERSION' ) ) {
       remove_filter( 'the_content', 'sharing_display', 19 );
       remove_filter( 'the_excerpt', 'sharing_display', 19 );
       add_filter( 'sharing_show', '__return_false', 9999 );
     }

Thanks!

Hi Vink,

Thanks, it looks like jetpack isn’t really utilizing the excerpt, for example

$exploded_content_on_more_tag = explode( '<!--more-->', $data->post_content );
$tags['og:description']       = wp_trim_words( preg_replace( '@https?://[\S]+@', '', strip_shortcodes( wp_kses( $exploded_content_on_more_tag[0], array() ) ) ) ); 

It does pull the content and generates its own excerpt, hence, some of the shortcodes are still visible. I’ll add this to our issue tracker as compatibility issue as I can’t find any temporary solution, it doesn’t have a hook that can modify the displayed content. But we’ll check what else can we do,

For now, I recommend adding excerpt to your page and posts manually, based on the coding on jetpack plugin, it first pulls the manual excerpt before the post_content. Please check this https://www.wpbeginner.com/plugins/add-excerpts-to-your-pages-in-wordpress/, but just skip the Displaying Excerpts for Pages in WordPress.

Thanks!

Hi Vink,

Just letting you know that this is already fixed on our unreleased version. The issue is with jetpack as it’s pulling the description from post_content instead from the Wordpress’ generated excerpt. Hence, it picks the raw content where [cs_content_seo] is still visible, and with that, it bypasses all the cleaning feature that excerpt normally have. Since jetpack is a 3rd party plugin then we can’t directly edit it for the fix, instead we just added a code to extend the cleaning.

The temporary workaround that can implement is this, while we’re not yet releasing the update.


add_filter( 'jetpack_open_graph_tags', 'x_clean_cs_content_seo', 999999 );  
      

function x_clean_cs_content_seo ( $opengraph ) {
      
      $description = $opengraph ['og:description'];

      if ( !strpos( $description, '[cs_content_seo]') ) {

        $opengraph ['og:description'] = preg_replace('/\[cs_content_seo\]|\[\/cs_content_seo\]/m', '', $description );
      
      }

      return  $opengraph;

  }
  

You can add that code to your child theme’s functions.php as temporary fix.

Thanks!

Hi @rad,

Thanks so much! Untill the new update releases we’ll use this in the functions.php. It works like a charm!

Thanks for the effort!

You’re welcome. Glad we’re able to help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.