Tagged: php notice
- This topic has 2 replies, 2 voices, and was last updated 5 years, 4 months ago by
Tonny Keuken.
Viewing 2 reply threads
-
AuthorPosts
-
-
September 17, 2016 at 11:58 pm #7345
eddie2390ParticipantPHP Notice: Undefined index: order in /xxxxx/xxxxxxx/public_html/wp-content/plugins/piklist/includes/class-piklist-wordpress.php on line 192
-
September 22, 2016 at 5:25 am #7370
Tonny KeukenMemberHi 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
-
September 22, 2016 at 5:27 am #7371
Tonny KeukenMemberThis reply has been marked as private.
-
-
AuthorPosts
Viewing 2 reply threads
- You must be logged in to reply to this topic.