Last active
May 1, 2019 23:05
-
-
Save landbryo/a46f605e7a5768f059b2bb7b7d823c53 to your computer and use it in GitHub Desktop.
A filter to override the Restrict Content Pro - Resume Manager resume limit and set it to a custom value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_set_limit( $at_limit, $user_id ) { | |
if ( is_user_logged_in() && ! current_user_can( 'administrator' ) ) { | |
if ( empty( $user_id ) ) { | |
$user_id = get_current_user_id(); | |
} | |
$resume_args = array( | |
'post_type' => 'resume', | |
'posts_per_page' => 999, | |
'post_status' => array( 'publish', 'pending', 'hidden' ), | |
'author' => $user_id, | |
'update_post_term_cache' => false, | |
'update_post_meta_cache' => false, | |
'cache_results' => false, | |
); | |
$resumes = new WP_Query( $resume_args ); | |
$count = $resumes->post_count; | |
if ( $count >= 1 ) { | |
return $at_limit = true; | |
} | |
} | |
} | |
add_filter( 'rcp_rm_is_at_resume_limit', 'custom_set_limit', 2, 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment