New answers tagged

1

I think your conception of how hooks work is slightly off. If you are outputting something that contains the URL and title of the queried object, then this isn't something you'd typically need to worry about. You bring up two types of filters that you're concerned about: using pre_get_posts, and filtering titles. In the case of pre_get_posts, this does not ...


0

One way I have found to be working is to remove the filters manually added by WPML core, like so: global $wpml_query_filter; /** * WPML fetch in all languages */ remove_filter( 'posts_join', array( $wpml_query_filter, 'posts_join_filter' ), 10, 2 ); remove_filter( 'posts_where', array( $wpml_query_filter, 'posts_where_filter' ), 10, 2 ); That's ...


0

Looking at the WP_Query Class you should be able to use pre_get_posts to modify the query before any other filters are run, which includes turning off the suppress_filters flag. An example of this could be: /** * Modify WP_Queries * @link https://wordpress.stackexchange.com/q/356950/7355 * * @param WP_Query $query * * @return void */ function ...


0

In the WP Docs you can find the answer. I have not tested this snippet, but it should become something like this: $args = array( 'post_type' => 'product', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'product-ean', 'value' => 123, 'compare' => '=', ...


0

Your code uses this: number_format((float)$results[$i]['avg_rate'], 2, '.', '') And if we look at where $i is set, we see this just before the loop: $i=0; and this: $i++; But I don't see how this maps in any way to the current post when there's a conditional, meaning that not everything in the results array is included in the post query. ...


Top 50 recent answers are included