我试过下面的代码,但不起作用。43是论坛页面的ID。我也在尝试使用is_user_logged_in()
:
function forumpage()
{
global $post;
global $wp_query;
if ($post->post_parent != 43)
{
$thePostID = $post->post_parent;
// echo \'You are not on the forum page\';
}
else
{
$thePostID = $wp_query->post->ID;
// echo \'You are at the forum page\';
}
}
add_action( \'init\' , \'forumpage\' );