在标题中使用 WordPress 短代码
我有一些短代码可以在 WordPress 帖子或页面中正常工作。我可以在functions.php中添加什么东西来使短代码能够在WordPress帖子标题中工作吗?
I have some shortcodes which work fine inside a WordPress post or page. Is there anything I can add to functions.php to enable a shortcode to work inside a WordPress post title?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试在
functions.php
文件中的标题中添加过滤器,例如:似乎对我有用,但它可能会对您的永久链接造成严重破坏,我不推荐这样做。
将来,与 WordPress 相关的问题最好直接访问 https://wordpress.stackexchange.com/。
You could try adding a filter to the title in the
functions.php
file such as:Seems to work for me, however it may play havoc with your permalink's and I wouldn't recommend it.
In future WordPress related questions might be better directed at https://wordpress.stackexchange.com/.
如David所述,将以下过滤器添加到
functions.php
中,但是,这种方法可能会如果您使用 Yoast SEO 插件,则不起作用。为此,您还需要添加以下过滤器:
Add the following filter to
functions.php
as mentioned by DavidHowever, this approach may not work if you are using the Yoast SEO plugin. For that, you need to add the following filter too: