admin管理员组

文章数量:1022552

I created a custom page template that will show sales from a hotel. I have 3 users and I want each user to only see their hotel sales on a user profile specific page. The template calls data using the REST API response (custom post type). I have tried this:

<?php function get_current_user_id() {
if ( ! function_exists( 'wp_get_current_user' ) ) {
    return 0;
}
$user = wp_get_current_user();
return ( isset( $user->ID ) ? (int) $user->ID : 0 );

<?php
if ($user-> ID == 5){
    get_post(13);
}
else ( get_post(3));
?>

My idea is if it's user 5, show the page, if not show another page...

I created a custom page template that will show sales from a hotel. I have 3 users and I want each user to only see their hotel sales on a user profile specific page. The template calls data using the REST API response (custom post type). I have tried this:

<?php function get_current_user_id() {
if ( ! function_exists( 'wp_get_current_user' ) ) {
    return 0;
}
$user = wp_get_current_user();
return ( isset( $user->ID ) ? (int) $user->ID : 0 );

<?php
if ($user-> ID == 5){
    get_post(13);
}
else ( get_post(3));
?>

My idea is if it's user 5, show the page, if not show another page...

本文标签: customizationneed help with a userspecific custom page template