filters - how to use substr with get_the_content()

I'm setting og:description programmatically like this:$description = apply_filters( 'the_content', get_th

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!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744696125a4588501.html

相关推荐

  • filters - how to use substr with get_the_content()

    I'm setting og:description programmatically like this:$description = apply_filters( 'the_content', get_th

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信