Use main query object property directly on libs/class.Apply.php
-
Hi All the authors of the plugin!
Please replace
is_tag()
conditional tag to a direct query object property$query->is_tag
on class’sApply
methodqueryTag
.is_tag()
is not intended to be used onpre_get_posts
filter as it relies on globalWP_Query
object which is not ready/created at that point. (1)
This produces “PHP Notice: is_tag was called incorrectly.” (WP core @v5.3.2) (2)(1) https://developer.www.ads-software.com/reference/hooks/pre_get_posts/#a-warning-about-conditional-functions
(2) https://core.trac.www.ads-software.com/browser/tags/5.3.2/src/wp-includes/query.php#L287Method in question (download-manager @v3.0.9)
function queryTag($query) { if (is_tag() && $query->is_main_query()) { $post_type = get_query_var('post_type'); if (!is_array($post_type)) $post_type = array('post', 'wpdmpro'); else $post_type = array_merge($post_type, array('post', 'wpdmpro')); $query->set('post_type', $post_type); } return $query; }
Thanks
Martins
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Use main query object property directly on libs/class.Apply.php’ is closed to new replies.