Skip to content

Instantly share code, notes, and snippets.

@landbryo
Last active May 1, 2019 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save landbryo/a46f605e7a5768f059b2bb7b7d823c53 to your computer and use it in GitHub Desktop.
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.
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