请检查下面的代码。我想你面临的是404,因为它没有得到slug
&;这个url
正确地
add_action( \'bp_setup_nav\', \'mb_bp_profile_menu_posts\' );
function mb_bp_profile_menu_posts() {
global $bp;
bp_core_new_nav_item(
array(
\'name\' => \'My Posts\',
\'slug\' => \'myposts\',
\'position\' => 11,
\'default_subnav_slug\' => \'published\',
\'screen_function\' => \'mb_author_posts\',
\'parent_url\' => bp_displayed_user_domain() . \'/myposts/\',
\'parent_slug\' => $bp->profile->slug,
\'default_subnav_slug\' => \'myposts\',
)
);
}
function mb_author_posts() {
add_action( \'bp_template_title\', \'mb_author_posts_title\' );
add_action( \'bp_template_content\', \'mb_author_posts_content\' );
bp_core_load_template( \'buddypress/members/single/plugins\' );
}
function mb_author_posts_title() {
echo \'My Posts\';
}
function mb_author_posts_content() {
echo \'Content logic goes here...\';
}