我目前正在一个相当大的博客社区网站上工作(大约500000个单号/月)。我决定要为社区站点的所有不同部分建立一个网络,以将DB负载保持在最低限度。
IE:-用于用户生成配方的网站-用于用户论坛的网站(使用wordpress)-用于来宾博客帖子的网站
对于recipe站点,我正在考虑使用一个名为recipe的自定义帖子类型。我的问题是,默认情况下,我会得到如下URL:菜谱。领域com/recipe/%post name%或域。com/recipes/recipe/%post name%(取决于我在网络中使用的是子域还是子目录)。
因此,对于选项1,我可以删除我发现的以下标记http://www.ultimatewebtips.com/remove-slug-from-custom-post-type/或Wordpress 3.3 custom post type with /%postname%/ permastruct?
虽然这看起来不错,但我不想增加任何开销,也不必担心在更新wordpress或使用缓存插件时出现问题。我并不是说会,但我只是觉得搞乱permalink结构可能不是一个好主意。
对于第二个选项,我可以使用默认的post类型作为我的“配方”(因为我不会将其用于其他任何事情)。这样,我可以添加如下过滤器:
add_filter( \'gettext\', \'change_post_to_recipe\' );
add_filter( \'ngettext\', \'change_post_to_recipe\' );
function change_post_to_recipe( $translated )
{
$translated = str_replace( \'Post\', \'Recipe\', $translated );
$translated = str_replace( \'post\', \'Recipe\', $translated );
return $translated;
}
然后使用remove\\u post\\u type\\u support()删除我不需要的东西,如“editor”和“extract”。我唯一担心的是gettext或ngettext函数会被加载很多,我会进行大量的str\\u替换。使用默认的post类型的好处是,我可以使用所有默认的内置函数来完成我需要的工作,大多数插件都可以很好地使用它。
如有任何建议,将不胜感激。