user_can_create_post

Whether user can create a post.

Description

user_can_create_post( (int) $user_id, (int) $blog_id = 1, (string) $category_id = 'None' ); 

Parameters (3)

0. $user_id (int)
The user id.
1. $blog_id — Optional. (int) => 1
The blog id.
2. $category_id — Optional. (string) => 'None'
The category id.

Usage

  1. if ( !function_exists( 'user_can_create_post' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // The blog id. 
  8. $blog_id = 1; 
  9.  
  10. // The category id. 
  11. $category_id = 'None'; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = user_can_create_post($user_id, $blog_id, $category_id); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { 
  2. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  3.  
  4. $author_data = get_userdata($user_id); 
  5. return ($author_data->user_level > 1);