Skip to content

Instantly share code, notes, and snippets.

@dovidezra
Forked from dartiss/functions.php
Created December 7, 2020 17:31
Show Gist options
  • Save dovidezra/aa865a2f135b1237bf0c9784be277f17 to your computer and use it in GitHub Desktop.
Save dovidezra/aa865a2f135b1237bf0c9784be277f17 to your computer and use it in GitHub Desktop.
WordPress Plugin to List all Site Cookies
<?php
function get_cookies( $paras = '', $content = '' ) {
if ( strtolower( $paras[ 0 ] ) == 'novalue' ) { $novalue = true; } else { $novalue = false; }
if ( $content == '' ) { $seperator = ' : '; } else { $seperator = $content; }
$cookie = $_COOKIE;
ksort( $cookie );
$content = "<ul>n";
foreach ( $cookie as $key => $val ) {
$content .= '<li>' . $key;
if ( !$novalue ) { $content .= $seperator . $val; }
$content .= "</li>n";
}
$content .= "</ul>n";
return do_shortcode( $content );
}
add_shortcode( 'cookies', 'get_cookies' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment