最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

filters - how to use substr with get_the_content()

programmeradmin2浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论