Skip to content

Instantly share code, notes, and snippets.

@carlodaniele
Last active June 27, 2023 03:25
Show Gist options
  • Save carlodaniele/d1427af3203014943176 to your computer and use it in GitHub Desktop.
Save carlodaniele/d1427af3203014943176 to your computer and use it in GitHub Desktop.
Register custom query vars
<?php
/**
* Register custom query vars
*
* @param array $vars The array of available query variables
*
* @link https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars
*/
function myplugin_register_query_vars( $vars ) {
$vars[] = 'key1';
$vars[] = 'key2';
return $vars;
}
add_filter( 'query_vars', 'myplugin_register_query_vars' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment