Skip to content

Instantly share code, notes, and snippets.

@mikejolley
mikejolley / gist:9668782
Last active May 4, 2022 14:12
WP Job Manager Resumes & WC Paid Listings - If resumes require a 'has_active_job_package' capability, limit access to only those with an active job package. Once the package expires (e.g. job limit reached) access to resumes expires too.
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_job_package'
add_filter( 'user_has_cap', 'has_active_job_package_capability_check', 10, 3 );
/**
* has_active_job_package_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability