Tagged: 

Viewing 2 reply threads
  • Author
    Posts
    • #7345
      eddie2390
      Participant

      PHP Notice: Undefined index: order in /xxxxx/xxxxxxx/public_html/wp-content/plugins/piklist/includes/class-piklist-wordpress.php on line 192

    • #7370
      Tonny Keuken
      Member

      Hi everyone,

      I am using version 0.9.9.9 at this moment and the above notice came up in the log files.

      I figured it out, is was another query_var that was causing this.

      I also use WooCommerce, and their plugin using also the query_vars, but without setting query_vars[‘order’]

      So I changed the pre_get_posts(&$query) function in class-piklist-wordpress.php, and it solved my problem.

      Just added the && isset($query->query_vars[‘order’]) to the statement

      it’s about the lines 178 to 202

      function now looks like:

        /**
         * pre_get_posts
         * Get the order parameter if it has to do with meta
         *
         * @param object $query The current query object.
         *
         * @access public
         * @static
         * @since 1.0
         */
        public static function pre_get_posts(&$query)
        {
          if (isset($query->query_vars['orderby']))
          {
            if (in_array($query->query_vars['orderby'], array('meta_value', 'meta_value_num')) && isset($query->query_vars['order']) && !is_null($query->query_vars['order']))
            {
              self::$meta_order = $query->query_vars['order'];        
            }
      
            if ( isset($query->query_vars['meta_key']) && !is_null($query->query_vars['meta_key']))
            {              
              self::$meta_key = $query->query_vars['meta_key'];
            }
          }
        }
      

      Hope it helps

      Tonny

    • #7371
      Tonny Keuken
      Member
      This reply has been marked as private.
Viewing 2 reply threads
  • You must be logged in to reply to this topic.