ap_user_can_permanent_delete( null|WP_Post|int $post = null, false|int $user_id = false )
Description #
Check if user can permanently delete a AnsPress posts
Parameters #
- $postnull | WP_Post | int (Optional) Post id or object. Default value: null
- $user_idfalse | int (Optional) User id. Default value: false
Source #
File: includes/class/roles-cap.php
function ap_user_can_permanent_delete( $post = null, $user_id = false ) { if ( false === $user_id ) { $user_id = get_current_user_id(); } $_post = ap_get_post( $post ); // Return false if not question or answer. if ( ! in_array( $_post->post_type, array( 'question', 'answer' ), true ) ) { return false; } if ( is_super_admin( $user_id ) || user_can( $user_id, 'ap_delete_post_permanent' ) ) { return true; } return false; }
Expand full source code Collapse full source code View on GitHub: includes/class/roles-cap.php:709
Add your comment