Advertisement
verygoodplugins

Untitled

Jan 17th, 2020
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. function check_custom_post_type( $can_access, $user_id, $post_id ) {
  2.  
  3.     if ( 'test' == get_post_type( $post_id ) ) {
  4.  
  5.         $client_id = get_field( 'client_name', $post_id );
  6.  
  7.         if ( $user_id != $client_id ) {
  8.             $can_access = false;
  9.         }
  10.  
  11.     }
  12.  
  13.     return $can_access;
  14.  
  15. }
  16.  
  17. add_filter( 'wpf_user_can_access', 'check_custom_post_type', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement