admin管理员组

文章数量:1391969

I'm setting og:description programmatically like this:

$description = apply_filters( 'the_content', get_the_content() );

This works fine.

However, the $description contains some superfluous content which I'm trying to remove. When I do this it never seems to work. This is what I'm trying:

$pos = strpos( $description, $superfluous_content ) + strlen( $superfluous_content );
$description = substr( $description, $pos );

I've tried removing html tags and all kinds of different approaches, but it never makes a difference. I'm guessing $description contains some kind of hidden characters as $pos always returns 0.

Can anyone suggest what's happening here and how I can manipulate $description as a simple text string?

Thanks in advance!

本文标签: filtershow to use substr with getthecontent()