wordpress - 如何使用 Yoast SEO 在站点地图中包含具有自定义帖子状态的帖子?
问题描述
archived
我使用该功能创建了一个自定义帖子状态register_post_status
。我刚刚意识到插件 Yoast SEO,不会在站点地图中使用它。只有那些在发布中。
如何在站点地图中包含自定义帖子状态?
解决方案
Yoast SEO在 11.2 版本中实现了一个新的过滤器来处理这个问题
这是执行此操作的方法:
function yoast_add_custom_status( $post_statuses) {
// var_dump($post_statuses);die();
$post_statuses = array( 'publish','YOUR_CUSTOM_STATUS' ); //add your custom statuses
return $post_statuses;
}
add_filter( 'wpseo_sitemap_post_statuses', 'yoast_add_custom_status');
推荐阅读
- ios - 如果iOS设备中不存在用于应用商店提交的另一个应用程序,如何继续调用另一个应用程序?
- kotlin - 'javaClass' 的纯 Kotlin 替代品是什么?
- json - 如何将相关实体放入json?
- python - 通过任何方法生成对抗样本时接收断言失败
- grails - 在 Grails 上响应错误时如何过滤 deniedValue 属性?
- python-3.x - Jupyterlab 选项卡完成没有提供有用的建议
- c - 使用 CTRL-D 退出带有 fgets 的 while 循环
- android - Android:AWS 上传的所选图像出现无效文件错误
- c - 如何创建 Makefile 来正确编译我的 C 代码?
- python-3.x - 在 Google colab 中使用海龟图形