Last active
July 24, 2021 16:14
-
-
Save landbryo/93e813bc6578cf31a9f8d760741d5bf2 to your computer and use it in GitHub Desktop.
Disable View Limit functionality for posts by providing their IDs in posts array
This file contains hidden or 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
<?php | |
/** | |
* Plugin Name: View Limit - Exclude Posts by ID | |
* Description: Disable View Limit functionality for posts by providing their IDs in posts array | |
* Version: 0.0.1 | |
* Requires at least: 5.2 | |
* Requires PHP: 7.1 | |
* Author: Landon Otis | |
* Author URI: https://missionlab.dev | |
*/ | |
add_filter( 'skpvl_is_active', function ( $active ) { | |
global $post; | |
// Array of post/page/custom post IDs, update these to match your website | |
$posts = [ | |
25, | |
26, | |
27, | |
28 | |
]; | |
if ( in_array( $post->ID, $posts ) ) { | |
$active = false; | |
} | |
return $active; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @landbryo, i found your profile when i was searching for a way to change the limit views addon, to limit file downloads instead of page views.
So theres no limit on page views but a limit on downloading a mp3 file attached to the post.
Would that be easy to change?
Thanks