query_vars = wp_parse_args( $args, $this->get_default_query_vars() ); } /** * Get the current query vars. * * @return array */ public function get_query_vars() { return $this->query_vars; } /** * Get the value of a query variable. * * @param string $query_var Query variable to get value for. * @param mixed $default Default value if query variable is not set. * @return mixed Query variable value if set, otherwise default. */ public function get( $query_var, $default = '' ) { if ( isset( $this->query_vars[ $query_var ] ) ) { return $this->query_vars[ $query_var ]; } return $default; } /** * Set a query variable. * * @param string $query_var Query variable to set. * @param mixed $value Value to set for query variable. */ public function set( $query_var, $value ) { $this->query_vars[ $query_var ] = $value; } /** * Get the default allowed query vars. * * @return array */ protected function get_default_query_vars() { return array( 'name' => '', 'parent' => '', 'parent_exclude' => '', 'exclude' => '', 'limit' => get_option( 'posts_per_page' ), 'page' => 1, 'offset' => '', 'paginate' => false, 'order' => 'DESC', 'orderby' => 'date', 'return' => 'objects', ); } }