【发布时间】:2020-02-25 01:39:02
【问题描述】:
我正在尝试删除事件日历 (TEC) 插件添加到事件(JSON LD 格式)中的一些结构化数据。具体来说,我正在尝试删除开始和结束时间。这是插件的演示站点在 Google 结构化数据测试工具中的显示方式:https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fwpshindig.com%2Fevents%2F
通过研究,我发现 TEC 有一个 hook,它允许覆盖和调整结构化数据:https://docs.theeventscalendar.com/reference/hooks/tribe_json_ld_markup/
我还找到了一个如何将此钩子添加到我的主题的functions.php文件的示例(该网站在WordPress上运行):
add_filter( 'tribe_json_ld_markup', 'my_func' );
function my_func( $html ) {
// Do something with $html
return $html;
}
我不太了解 PHP,所以我不知道我需要用什么替换评论,以便从结构化数据中删除时间。我希望你能帮忙!
【问题讨论】:
标签: json wordpress schema structured-data