1. Go to this page and download the library: Download lwplugins/lw-cookie library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lwplugins / lw-cookie example snippets
// Get all consent categories
$categories = apply_filters( 'lw_cookie_consent_categories', [] );
// ['necessary' => true, 'functional' => false, 'analytics' => true, 'marketing' => false]
// Check if user has given any consent
$has_consent = apply_filters( 'lw_cookie_has_consent', false );
// Check if specific category is allowed
$analytics_ok = apply_filters( 'lw_cookie_is_category_allowed', false, 'analytics' );
// Prevent blocking specific scripts (e.g., if your plugin handles consent)
add_filter( 'lw_cookie_should_block_script', function( $should_block, $handle, $src, $category ) {
if ( $handle === 'my-plugin-pixel' ) {
return false; // Don't block, I handle consent myself
}
return $should_block;
}, 10, 4 );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.