Title: How to set a global variable
Last modified: August 22, 2016

---

# How to set a global variable

 *  [Caravaggio76](https://wordpress.org/support/users/caravaggio76/)
 * (@caravaggio76)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/how-to-set-a-global-variable/)
 * Hi, I need your help.
    I’m a beginner with WP and I’d like to know how to set
   a global variable and filter the query result of my site.
 * Example:
    In my movie site I have a navigation menu with 3 categories: – Horror–
   Triller – Comedy
 * In the sidebar I want to put another menu (maybe check boxes) with the years 
   of the movie
    – 2011 – 2012 – 2013
 * Now, when I choose the year, for example 2012, I want to set a global variable
   so the result of the query of my main menu items will change.
    In this case if
   i click “triller” I will see only the triller movie of the 2012. Then if I change
   the section clicking “comedy” the result of the query will shows comedy movie
   of the 2012…so until I will change or reset the year.
 * Can you help me?
 * (sorry for my english)

The topic ‘How to set a global variable’ is closed to new replies.

## Tags

 * [query](https://wordpress.org/support/topic-tag/query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Caravaggio76](https://wordpress.org/support/users/caravaggio76/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/how-to-set-a-global-variable/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
