Skip to content

Instantly share code, notes, and snippets.

@landbryo
Last active July 24, 2021 16:14
Show Gist options
  • Save landbryo/93e813bc6578cf31a9f8d760741d5bf2 to your computer and use it in GitHub Desktop.
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
<?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;
} );
@blow22
Copy link

blow22 commented Jul 24, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment