我正在使用适用于WordPress的WordLift插件,并且想在我的网站中为其他自定义帖子类型添加对语义SEO的支持。有没有办法做到这一点?
最佳答案
是的,有一个过滤器可用于添加自定义帖子类型:wl_valid_entity_post_types
。
筛选器采用具有受支持的帖子类型(默认为post
,page
和entity
)的数组。您可以将自定义帖子类型添加到数组中并返回它,例如:add_filter('wl_valid_entity_post_types', function ($post_types) { $post_types[] = 'gallery'; return $post_types;});
供参考add a WordPress filter to allow customers to extend the post types that can be turned into entities在GitHub上。