Support

Account

Forum Replies Created

  • I think I got this solved.

    I have created the fields with the Admin user (user_id == 1) and the field appeared when I modified the query to include the Admin user_id. Here is the code I’m using now to prevent other users from seeing others posts and displays the fields on post.php page.

    
    add_filter('pre_get_posts', function($query) {
    
        if ($query->is_admin) {
            global $user_ID;
            global $pagenow;
    
            $allowedPages = ['post.php', 'post-new.php', 'admin-ajax.php'];
    
            if (in_array($pagenow, $allowedPages)) {
                $query->set('author__in', [$user_ID, 1]);
            } else {
                $query->set('author', $user_ID);
            }
        }
    
        return $query;
    
    });
    
    
  • I have exactly the same issue. Would be most appreciated if a solution would be provided.

    Cheers!

Viewing 2 posts - 1 through 2 (of 2 total)