home_url() 将接受将在创建URL时使用的参数。
最基本的解决方案是:
add_action(
\'wp_logout\',
create_function(
\'\',
\'wp_redirect(home_url("/path/to/page"));exit();\'
)
);
site_url() 也将接受相同的参数,可能是(可能是)更好的选择。
我相信使用这两种方法中的任何一种都会使链接依赖于永久链接设置。我不认为这些函数会在不同的设置之间转换,尽管我还没有测试过。
我建议使用get_permalink() 具有明确的页面/帖子ID。
add_action(
\'wp_logout\',
create_function(
\'\',
\'wp_redirect("\'.get_permalink(1).\'");exit();\'
)
);
请注意,您不需要
home_url() 或
site_url() 自从
get_pemalink() 将生成完整的URL。